Say I've got a base class Foo.
public class Foo
{
public Foo()
{
Console.WriteLine("Foo Constructor");
}
}
Now say I've got a derived class Bar.
public class Bar : Foo
{
public Bar()
{
Console.WriteLine("Bar Constructor");
}
}
When you instantiate Bar, you'll get the following in your console output:
Foo Constructor
Bar Constructor
That's fine. That's the expected behavior. But what if I want to completely override or ignore the constructor for Foo? The compiler doesn't like it when you declare a constructor virtual, and even if I could, I don't think there's a syntax for overriding it. It seems that I have to take the base class constructor method whether I want it or not.
Am I missing something here?