1 struct base 2 { 3 enum mode : short { in, out, top, bottom }; 4 enum state { pass, fail, unknown }; 5 typedef long int_type; 6 }; 7 8 struct C1 : public base 9 { 10 mode _M_type; 11 }; 12 13 // virtual by derivation 14 struct C2 : virtual public base 15 { 16 mode _M_type; 17 }; 18 19 // virtual by member function 20 struct C3 : public base 21 { 22 mode _M_type; 23 ~C3C324 virtual ~C3() { }; 25 }; 26 27 // abstract virtual by member function 28 struct C4 : public base 29 { 30 mode _M_type; 31 32 virtual void foo() = 0; 33 }; 34 main()35int main() 36 { 37 C1 obj1; 38 C2 obj2; 39 C3 obj3; 40 // C4 obj4; XXX abstract 41 return 0; 42 } 43