题目内容
写结果。class Bclass {public:Bclass( int i, int j ) { x = i; y = j; }virtual int fun() { return 0 ; }protected: int x, y ; };class Iclass:public Bclass {public :Iclass(int i, int j, int k):Bclass(i, j) { z = k; }int fun() { return ( x + y + z ) / 3; }private : int z ; };int main(){ Iclass obj( 2, 4, 6 );Bclass p1 = obj;cout << p1.fun() ;Bclass & p2 = obj ;cout << p2.fun() ;cout << p2.Bclass :: fun() ;Bclass *p3 = &obj;cout << p3 -> fun() ;return 0;}
查看答案
搜索结果不匹配?点我反馈