George George

George George

  • NA
  • 778
  • 0

base method

Oct 29 2008 9:42 PM

Hello everyone,


I noticed in some code, in a derived class, the constructor will be written in a way like this, my question is whether it is good code to add base()? Because I think

- base() will be implicitly called for derived class constructor if we do not pass any parameters to base class;
- if we need to pass any parameters, I think we could declare in this way and pass parameter to base class in :base (parameters to base class constructor);
- so there is no need to declare in this way.

Any comments? Is my understanding correct?

[Code]
DerivedClassConstructor():base()
{
    // derived class constructor implementation
}
[/Code]


thanks in advance,
George


Answers (4)