单项选择题

有如下程序:
#include <iostream.h>
#include <iomanip.h>
using namespace std;
class CSum
int x,y;
public:
CSum (int x0,int y0):x(x0),y(y0)
friend ostream & operator<<(ostream& os,const CSum& x

A.

&nbs
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序 #include <iostream> #include <string> using namespace std; class base private: char baseName[10]; public: base () strcpy(baseName, Base ); virtual char *myName() return baseName; char *className() return baseName; ; class Derived : public base private: char derivedName[10]; public: Derived() strcpy(derivedName, Derived ); char *myName() return derivedName; char *className() return derivedName; ; void showPtr(base &p) cout<<p.myName () << <<p.className (); int main () base bb; Derived dd; showPtr(dd); return 0; 运行后的输出结果为
A.Derived Base
B.Base Base
C.Derived Derived
D.Base Derived
单项选择题
有如下程序: #include <iostream.h> using namespace std; class Base public: Base() cout<< BB ; f(); voidf()cout << Bf ; ; class Derived: public Base public: Derived ()cout<< DD ; void f()cout<< Df ; ; int main()Derived d; return 0; 执行上面的程序将输出
A.BBBfDD
B.BBDfDDDf
C.DD
D.DDBBBf
相关试题
  • 下面是一个栈类的模板,其中push函数将元素...
  • 下列程序将x、y和z按从小到大的顺序排列,...
  • 多数运算符既能作为类的成员函数重载,也能...
  • 假定A为一个类,则语句A(A &a);为该类...
  • 在下面程序的横线处填上适当的语句,使该程...