Articles → CSHARP → Why Can't We Instantiate Abstract Class
Why Can't We Instantiate Abstract Class
Example
public abstract class AbstractClass {
protected AbstractClass(int x) {
Console.WriteLine("Abstract Constructor");
}
}
public class DerivedClass: AbstractClass {
public DerivedClass(int x): base(x) {
Console.WriteLine(x);
}
}
DerivedClass cls = new DerivedClass(10);
Output
Click to Enlarge