正在加载图片...
Class Declaration Definition(cont,) u Question: If class a has a pointer data member that pointing to class B, and vice versa, how to define class a and B? Answer: Using Forward Declaration class A. class B: class A public B* m pb; } class B public A m_ paClass Declaration & Definition (cont.) ◼ Question: If class A has a pointer data member that pointing to class B, and vice versa, how to define class A and B? ◼ Answer: Using Forward Declaration class A; class B; class A { public: B* m_pb; }; class B { public: A* m_pa; };
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有