using namespace std;
class A{
public:
A(int i=0):r1(i){}
void print(){cout<<'E’<
int r1;
};
int main(){
A a1;
const A a2(4);
(2);
();
return 0;
}
运行时的输出结果是
A)P8-E4
B)P8-C16-
C)P0-E4-
D)P0-C16-
(30)下列代码声明了3个类
class Person{};
class Student:public Person{};
class Undergraduate:Student{};
下列关于这些类之间关系的描述中,错误的是
A)类Person是类Undergraduate的基类
B)类Undergraduate从类Student公有继承
C)类Student是类Person的派生类
D)类Undergraduate是类Person的派生类
(31)有如下程序
#include
using namespace std;
Class Base{
public:
Base(int x=0):valB(x){cout<
int valB;
};
class Derived:public Base{
public:
Derived(int x=0,int y=0):Base(x),valD(y){cout<
int valD;