Default constructor
From: al (allin_at_168.net)
Date: 12/30/03
- Next message: Martin Eisenberg: "Re: Accessor Methods"
- Previous message: Michael S.: "Re: Scope-problems"
- Next in thread: Adam Fineman: "Re: Default constructor"
- Reply: Adam Fineman: "Re: Default constructor"
- Reply: Victor Bazarov: "Re: Default constructor"
- Reply: Dan Cernat: "Re: Default constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Dec 2003 18:53:01 GMT
class Base
{
public:
//Base() {}
Base(int m) {}
};
class Derive : public Base
{
public:
Derive(int m) {}
};
The above code keeps giving compiler error: 'Base': no appropriate default
constructor available, until a default cstor, Base() is added into Base
class.
Does this mean that a default cstor has always to be added whenever a
non-default cstor present?
Or is this default cstor, Base(), only required during inheritance? How to
make Derive to call Base(int m) rather than Base()?
In general, when does a default cstor have to be provided?
Thanks!
- Next message: Martin Eisenberg: "Re: Accessor Methods"
- Previous message: Michael S.: "Re: Scope-problems"
- Next in thread: Adam Fineman: "Re: Default constructor"
- Reply: Adam Fineman: "Re: Default constructor"
- Reply: Victor Bazarov: "Re: Default constructor"
- Reply: Dan Cernat: "Re: Default constructor"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]