class A {...}; class B {...}; class C: public A, private B {...}; A a = new C(); B b = new C();在C++中,繼承有public, protected and private
如果使用private的話 第6行編譯是不會過的 因為privated下是看不到的
如果是protected 則在可視scope下才能用
這點是java或其他OO語言沒有的
class A {...}; class B {...}; class C: public A, private B {...}; A a = new C(); B b = new C();在C++中,繼承有public, protected and private
#define fun(A, b) (int)(&(((A *)0)->b)) typedef struct { char str[40]; int type; int maxLen; } intf;問題是fun(intf, maxLen)的值為多少