在线等回答

cjoy4856 2009-03-13 11:15:30
public Product(string make, string model) :base(make, model)-------->这里的:base()是什么意思?
abstract public class MotorVehicle { public string make; public string model; public MotorVehicle(string make, string model) { this.make = make; this.model = model; } abstract public void Accelerate(); } public class Product : MotorVehicle { public Product(string make, string model) :base(make, model) { // do nothing } public override void Accelerate() { Console.WriteLine("In Product Accelerate() method"); Console.WriteLine(model + " accelerating"); Console.ReadLine(); } } class MainClass { public static void main() { Product myProduct = new Product("Toyota", "MR2"); myProduct.Accelerate(); } }
...全文
74 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cjoy4856 2009-03-13
  • 打赏
  • 举报
回复
你能说的详细一点吗?我是刚学的,之前是学java,好想基类没有给该方法
dingwb 2009-03-13
  • 打赏
  • 举报
回复
public Product(string make, string model) :base(make, model)-------->这里的:base()是什么意思?
调用基类实现飞product方法
cjoy4856 2009-03-13
  • 打赏
  • 举报
回复
在类MotorVehicle 中没有Product() 方法,MotorVehicle 没有定义它
wuyi8808 2009-03-13
  • 打赏
  • 举报
回复
public Product(string make, string model) :base(make, model)-------->这里的:base()是什么意思?

调用基类的 Product() 方法。

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧