首页 > 解决方案 > 具有前向声明成员时的类中的静态成员

问题描述

假设我有一个类foo,其中声明了一个成员bar转发。如果我想在类中使用静态函数,我需要知道的定义bar吗?

class bar;
class foo:
{
   private:
   bar m_bar;
   
   public:
   static int DoStuff();
}

如果我foo::DoStuff();通过包含使用,foo.h我需要知道什么bar吗?

标签: c++

解决方案


推荐阅读