Re: If default constructor is not there and parameterized constructor is there, will it work ??
- From: "Arnaud Debaene" <adebaene@xxxxxxxxxxxxxxxx>
- Date: Sun, 15 May 2005 19:47:49 +0200
Jigar Mehta wrote:
> Hi,
> the point i wanted to make was it does not run successfully when we
> derive the class and base class does not have default constructor..
Of course it does! You just need to supply the correct base class
constructor call in the derived class initialization list !
class Base
{
public :
Base (int param) {};
};
class Derived : public Base
{
public :
Derived() : Base(5) {}; //works
Derived (int param2) : Base (param2) {}; //works too
};
Arnaud
MVP - VC
.
- Follow-Ups:
- References:
- If default constructor is not there and parameterized constructor is there, will it work ??
- From: Jigar Mehta
- Re: If default constructor is not there and parameterized constructor is there, will it work ??
- From: Arnaud Debaene
- Re: If default constructor is not there and parameterized constructor is there, will it work ??
- From: Jigar Mehta
- Re: If default constructor is not there and parameterized constructor is there, will it work ??
- From: Fred
- Re: If default constructor is not there and parameterized constructor is there, will it work ??
- From: Jigar Mehta
- If default constructor is not there and parameterized constructor is there, will it work ??
- Prev by Date: Re: Use API windows in c source
- Next by Date: Re: question on win32 api readfile on serial port
- Previous by thread: Re: If default constructor is not there and parameterized constructor is there, will it work ??
- Next by thread: Re: If default constructor is not there and parameterized constructor is there, will it work ??
- Index(es):
Relevant Pages
|