单项选择题
有如下类的定义。那么空格处的语句是( )。
class MyClass
____________int x,y;
public:
MyClass(int x1=0,int y1=0)
x=x1;
y=y1;
static void change()
x+=10;
y+=10;
;
A.static
B.const
C.private
D.不需要填入内容
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
以下程序的执行结果为( )。 #include<iostream.h> Class sample int n; public: sample(int i)n=i; operator ++() n++; void display() cout<<n<<end1; ; void main() sample obj(5); obj++; obj.display();
A.5
B.6
C.7
D.8
点击查看答案&解析
单项选择题
有以下程序: #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.DerivedBase
B.BaseBase
C.DerivedDerived
D.BaseDerived
点击查看答案&解析
相关试题
有如下的类的模板定义: template <clas...
设文件temp.txt 已存在,则以下的打印结...
若要把类 FriendClass 定义为类 MyClass...
有以下程序: #include <iostream> u...
有以下程序: #include <iostream> u...