【发布时间】:2021-05-25 13:32:39
【问题描述】:
Computer.cs
class Computer // parent class
{
public string a;
public string b;
public Property(string a, string b)
{
this.a = a;
this.b = b;
}
}
Laptop.cs
class Laptop : Computer // child class
{
public string y;
public string b;
public Property(string y) // i dont know what comes here
{
this.y = y;
}
}
Desktop.cs
class Desktop : Computer // child class
{
public string x;
public string b;
public Property(string x) // i dont know what comes here
{
this.x = x;
}
}
this.something = something
【问题讨论】:
-
也许你需要了解一下constructors? “构造函数是一种方法,其名称与其类型的名称相同” - 不确定是否是问题所在。