{ test obj1;
test obj2(59); obj1.display(); obj2.display(); }
24. 写出下列程序的运行结果 #include
Count() { count++;}
static int getn() {return count;} ~Count() { count--; } private: static int count; };
int Count::count=100; void main()
{ Count c1,c2,c3,c4; cout< 25. 写出下列程序的运行结果 #include void show() {cout<<\}; class derived: public base { public: void show() {cout<<\}; void main() {base demo1; derived demo2; demo1.show(); demo2.show(); demo2.base::show(); } 26. 分析下列程序的输出结果。 #include public: A() { cout<<\ virtual ~A() { cout<<\virtual void f() { cout<<\void g() { f(); } }; class B : public A{ public: B() { f(); cout<<\~B() { cout<<\}; class C : public B{ public: C() { cout<<\~C() { cout<<\void f() { cout<<\}; void main() { A *a=new C; a->g(); delete a; } 27. 写出下列程序的运行结果。 #include Rect(int l,int w) { length=l; width=w; } void Print() { cout<<\private: int length,width; }; void main() { Rect *p; p=new Rect(5,4); p->Print(); delete p; }