C# 下列public Point3D(int x,int y,int z): Point(x,y)语句显示有错误

[复制链接]
查看11 | 回复3 | 2013-5-27 22:06:06 | 显示全部楼层 |阅读模式
Point3D在构造父类的时候,不能写父类的名字,要写base,C#语言就这么规定的,你把代码弄成下面这样就没有错了。
public class Point
{
public int x, y;
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
}
public class Point3D : Point
{
public int z;
public Point3D(int x, int y, int z)
: b...
回复

使用道具 举报

千问 | 2013-5-27 22:06:06 | 显示全部楼层
public Point3D(int x,int y,int z): base(x,y)
{
this.z=z;
}...
回复

使用道具 举报

千问 | 2013-5-27 22:06:06 | 显示全部楼层
public class plot
{
publicint x,y;
public plot(int _x,int _y)
{
this.x = _x;
this.y = _y;
}
}
public class pl...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行