Code: Select all
public abstract class A
{
abstract A(int a, int b);
}
< /code>
Ich erhalte jedoch eine Nachricht, in der der abstrakte Modifikator für dieses Element ungültig ist. Mein Ziel war es, einen solchen Code zu erzwingen. < /P>
public class B : A
{
public B(int a, int b) : base(a, b)
{
//Some other awesome code.
}
}
< /code>
Dies ist alles C# .NET -Code. Kann mir jemand helfen? Was ich am Ende gemacht habe, war Folgendes: < /p>
private A() { }
protected A(int a, int b)
{
//Code
}
Code: Select all
public abstract class A
{
protected abstract A(int a, int b)
{
}
}
Ich sollte klar sein, dass ich meinen Standardkonstruktor privat gemacht habe und meinen anderen Konstruktor geschützt bin. Ich suche nicht wirklich nach einer Möglichkeit, meinen Code funktionieren zu lassen. Ich habe mich darum gekümmert. Ich möchte verstehen, warum C# Sie dies nicht tun lässt.