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 ConstructorBar 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?
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u
Page rendered at Thursday, August 28, 2008 6:38:51 AM (Central Daylight Time, UTC-05:00)
Disclaimer These comments are solely my opinion and do not represent or express the position of my employer in any way.