所以这可能听起来像一个n00b问题,但我想把2个类合并在一起.
像这样:
Ball oneBall = new Ball("red", 20);
Ball anotherBall = new Ball("blue",40);
Ball BigBall = new Ball(oneBall + anotherBall);
BigBall.size() //should say 60 right?
Run Code Online (Sandbox Code Playgroud)
我知道你会有这样的事情
class Ball{
public Ball(string Name , int size){}
// But to merge to of them?
public Ball(Ball firstBall, Ball secondBall){} //I know the arguments have to be added
{}
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是什么是超载(对吧?)假设看起来像?
谢谢,
c# ×1