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.
Archived: 2 Comments
Weber | February 26, 2004 5:16 PM
I can’t believe that you didn’t know this before……
delphij | February 26, 2004 6:52 PM
Sure I knew it however that does not mean everybody knows. Frankly this blob is intend to fill the blank so I will have at least one per day :-)