【单选题】假设您创建了一个类Square是GeometricObject的子类。分析以下代码:class Square extends GeometricObject { double length; Square(double length) { GeometricObject(length); }}
A.
程序编译正常,但是您不能创建Square的实例,因为构造函数没有指定Square的长度。
B.
该程序有一个编译错误,因为您试图非法调用GeometricObject类的构造函数。
C.
该程序编译 正常 ,但由于非法调用Square类的构造函数而出现运行时错误。
D.
该程序有一个编译错误,因为GeometricObject类没有 GeometricObject(length)构造函数。
【判断题】class Square{ double side; Square(double side) { this.side=side; } double computeArea() { return side*side; }}上述类声明中,关键字this可以省略。( )
【简答题】Direction: Complete the following sentence with a proper word from your textbook on P. 118. Change the form if necessary. We ought to make sure that everyone gets equal of the food. (n.)
【简答题】Henry's job was to examine people who crossed the frontier (边境) to make sure that they were not smuggling (走私) anything into the country. Every evening except at weekends, he would see a(n) ___ coming...
【单选题】有如下程序代码: #include using namespace std; class Square { public: Square(double _width = 0.0): width(_width) { } virtual double area() const { return width*width; } protected: double width; }; class Cube:...
【单选题】假设您创建一个Square类作为GeometricObject的子类。 分析以下代码: class Square extends GeometricObject { double length; Square(double length) { GeometricObject(length); } }
A.
该程序可以正常编译,但是您不能创建Square的实例,因为构造函数未指定Square的长度。
B.
该程序出现编译错误,因为您试图非法调用GeometricObject类的构造函数。
C.
该程序可以正常编译,但是由于非法调用Square类的构造函数而导致运行时错误。
【单选题】class Square{ double side; Square(double side) { this.side=side; } double computeArea() { return side*side; }}Square 正方形=new Square(10...
B.
创建类对象的语句Square 正方形=new Square(10.0);执行时,this代表当前对象“正方形”
【单选题】有如下程序代码: #include using namespace std; class Square { public: Square(double _width = 0.0): width(_width) { } virtual double area() const { return width*width; } protected: double width; }; class Recta...
【简答题】Translate these into Chinese. Do not use the gearshift in the place of the parking brake.Always set the parking brake fully and make sure that the gearshift is securely latched in P(Park)(automatic tr...