从Student类和Teacher类多重派生Graduate类
从Student类和Teacher类多重派生Graduate类
参考答案和解析
D
相关考题:
( 30 )下列代码声明了 3 个类class Person{};class Student:public Person{};class Undergraduate:Student{};下列关于这些类之间关系的描述中,错误的是A )类 Person 是类 Undergraduate 的基类B )类 Undergraduate 从类 Student 公有继承C )类 Student 是类 Person 的派生类D )类 Undergraduate 是类 Person 的派生类
下列代码段声明了3个类:class Person();class Student:public Person{};class Undergraduate:Student{};下列关于这些类之间关系的描述中,错误的是( )。A.类Person是类Undergraduate的基类B.类Undergraduate从类Student公有继承C.类Student是类Person的派生类D.类Undergraduate是类Person的派生类
假设已经定义好了一个类student,现在要定义类derived,它是从student私有派生的,定义类derived的正确写法是()。A、“classderived::studentprived{//…};”B、“classderived:studentpublic{//…};”C、“classderived:privatestudent{//…};”D、“classderived::studentpublicstuednt{//…};”
下列代码段声明了3个类:classPerson{);classStudent:publicPerson{};classUndergraduate:Student{);下列关于这些类之间关系的描述中,错误的是( )。A.类Person是类Undergraduate的基类B.类Undergraduate从类Student公有继承C.类Student是类Person的派生类D.类Undergraduate是类Person的派生类
类Teacher和Student是类Person的子类; Person p; Teacher t; Student s; //p, t and s are all non-null. if(t instanceof Person) { s = (Student)t; } 最后一句语句的结果是:()A、 将构造一个Student对象;B、 表达式是合法的;C、 表达式是错误的;D、 编译时正确,但运行时错误。
关于基类和派生类的描述中,错误的是()A、基类和派生类间是包含关系B、派生类中可以定义自己的成员C、基类成员在派生类中的访问权限与继承方式有关D、一个派生类可以从一个基类派生,也可以从多个基类派生
单选题下面有关继承的说法中,正确的是()A A类和B类均有C类需要的成员,因此可以从A类和B类共同派生出C类B 在派生新类时,可以指明是公有派生、私有派生或保护派生C 派生类可以继承基类中的成员,同时也继承基类的父类中的成员D 在派生类中,不能添加新的成员,只能继承基类的成员
单选题类Teacher和Student是类Person的子类; Person p; Teacher t; Student s; //p, t and s are all non-null. if(t instanceof Person) { s = (Student)t; } 最后一句语句的结果是:()A 将构造一个Student对象;B 表达式是合法的;C 表达式是错误的;D 编译时正确,但运行时错误。