有如下程序:
#include<iostream>
using namespace std; class XX
protected;
int k;
public:
XX(int n=5):k(n)
~XX( )cout<<"XX";
virtual void f( )const=0;
;
inline void XX::f( )constcout<<k+3;
class YY:public XX
public:
~YY( )cout<<"YY";
void f( )constout<<k-3;XX:f( );
;
int main( )
XX &p=*new YY;
p.f( );
delete &p;
return 0;
;
执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序:
#include <iostream>
using namespace std;
class XX
protected:
int k;
public:
XX(int n=5):k(n)
~XX( )
cout<<"XX";
virtual void f( ) const=0;
;
inline void XX::f( )const
cout<<k+3;
class YY : public XX
public:
~YY( )
cout<<"YY";
void f( ) const
cout<<k-3;
XX::f( );
;
int main( )
XX &p=* new YY;
p.f( );
delete &p;
return 0;
执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序:
#include<iostream>
using namespace std;
class XX
protected:
int k;
public:
XX(int n=5):k(n);
~XX( )
cout<<"XX":
virtual void f( )const=0;
;
inline void XX::f( )const
cout<<k+3;
;
class YY:public XX
public:
~YY( )
cout<<”YY”;
void f( )const
cout<<k-3; XX::f( );
;
int main( )
XX &p=*new YY;
P.f( );
delete &p;
return 0:
执行上面的程序将输出( )。
A:28XX B:28YYXX C:33XX D:33XXYY
有如下程序:#include<iostream>using namespace std;class XX{protected:int k;public:XX(int n=5):k(n){}~xx( ){cout<<"XX";}virtual void f( ) const=0;};inline void XX:: f( )const{cout<<k+3;};class YY: public XX{public:~YY( ){cout<<"YY";}void f( ) const{cout<<k-3;XX::f( );}};int main( ){XX &p=*new YY;p. f( );delete &p;return 0;}执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序: #include <iostream> using namespace std; class XX { protected: int k; public: XX(int n=5):k(n){} ~XX( ) { cout<<"XX"; } virtual void f( ) const=0; }; inline void XX::f( )const { cout<<k+3; } class YY : public XX { public: ~YY( ) { cout<<"YY"; } void f( ) const { cout<<k-3; XX::f( ); } }; int main( ) { XX &p=* new YY; p.f( ); delete &p; return 0; } 执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序: #include<iostream> using namespace std; class XX{ protected; int k; public: XX(int n=5):k(n){} ~XX( ){cout<<"XX";} virtual void f( )const=0; }; inline void XX::f( )const{cout<<k+3;} class YY:public XX{ public: ~YY( ){cout<<"YY";} void f( )const{out<<k-3;XX:f( );} }; int main( ){ XX &p=*new YY; p.f( ); delete &p; return 0; }; 执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序: #include<iostream> using namespace std; class XX{ protected; int k; public: XX(int n=5):k(n){} ~XX( ){cout<<"XX";} Virtual void f( )cons=0; }; inline void XX::f( )const{cout<<k+3;} class YY:public XX{ public: ~YY( ){cout<<"YY";} void f( )const{out<<k-3;XX:f( );} }; int main( ){ XX &p:*new YY, p.f( ); delete &p; return 0; }; 执行上面的程序将输出( )。
A:28XX B:28YYXX C:-33XX D:-33XXYY
有如下程序: #include<iostream> using namespace std; class XX { protected: int k; public: XX(int n=5):k(n){}; ~XX( ) { cout<<"XX": } virtual void f( )const=0; }; inline void XX::f( )const { cout<<k+3; }; class YY:public XX { public: ~YY( ) { cout<<”YY”; } void f( )const { cout<<k-3; XX::f( ); } }; int main( ) { XX &p=*new YY; P.f( ); delete &p; return 0: } 执行上面的程序将输出( )。
A:28XX B:28YYXX C:33XX D:33XXYY