delphij's Chaos

选择chaos这个词是因为~~实在很难找到一个更合适的词来形容这儿了……

26 Feb 2004

How to call c-tor of base class in C#?

Today I was consulted with the above question. In a C# program, we don’t have a “MyBase” keyword, however, we have a __base __keyword. A c-tor is a special case, in C#, the syntax is more like C++.

We should differentiate the case between c-tor and ordinary functions. In a ordinary function, we can just base() to call base function, in a c-tor, we must do this in a different manner:

public CDerived() : base()
{
}

Well this is not quite hard, and it’s always easy to get answers from MSDN :-) Personally I’d prefer consulting a e-book rather than a person is already overloaded.