题目内容

以下关于继承的说法不正确的是()

A. 在子类中可以访问基类的public成员。
B. 在子类中可以访问基类的protected成员。
C. 在子类中可以访问基类的private成员。
D. 在子类中可以访问基类的internal成员。

查看答案
更多问题

阅读以下程序public class Shape{private string comments;protected string name;public string Name{ get{ return name;} set{name = value;}}public void Draw() {}}public class Rectangle:Shape{protected int width;protected int height;public int Width{get{return width;} set{width=value;}}public int Height{get{return height;} set{height=value;}}public int ComputeArea(){}}以上Shape类中在Rectangle类中不可见的是()

A. comments
B. name
C. Name
Draw()

阅读以下程序public class Shape{private string comments;protected string name;public string Name{ get{ return name;} set{name = value;}}public Shape(){}public Shape(string name){}public void Draw() {}}public class Rectangle:Shape{protected int width;protected int height;public int Width{get{return width;} set{width=value;}}public int Height{get{return height;} set{height=value;}}public Rectangle(){}public Rectangle(int cx,int cy){}public int ComputeArea(){}}以上Shape类中的成员没有被Rectangle类继承的是()

A. comments
B. name
C. Name
D. 构造函数

阅读以下程序public class Shape{private string comments;protected string name;public string Name{ get{ return name;} set{name = value;}}public Shape(){}public Shape(string name){}public void Draw() {}}public class Rectangle:Shape{protected int width;protected int height;public int Width{get{return width;} set{width=value;}}public int Height{get{return height;} set{height=value;}}public Rectangle(){}public Rectangle(int cx,int cy){}public int ComputeArea(){}}以上在Rectangle类的ComputeArea中不可访问的是()

A. name
B. comments
C. Draw()
D. Width

阅读以下程序public class Shape{private string comments;protected string name;public string Name{ get{ return name;} set{name = value;}}public Shape(){}public Shape(string name){}public void Draw() {}}public class Rectangle:Shape{protected int width;protected int height;public int Width{get{return width;} set{width=value;}}public int Height{get{return height;} set{height=value;}}public Rectangle(){}public Rectangle(int cx,int cy){}public int ComputeArea(){}public void Print(){Console.WriteLine(name);//Line:1Console.WriteLine(Name);//Line:2Console.WriteLine(comments); //Line:3Draw();//Line:4}}以上程序中错误的是()

A. Line:1
B. Line:2
C. Line:3
D. Line:4

答案查题题库