Click here to Skip to main content
15,914,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: getting and displaying icons... Pin
G_S17-May-05 22:16
G_S17-May-05 22:16 
GeneralRe: getting and displaying icons... Pin
Mridang Agarwalla18-May-05 6:20
Mridang Agarwalla18-May-05 6:20 
GeneralUser modifiable plots, wanted Pin
stromboli17-May-05 21:52
stromboli17-May-05 21:52 
GeneralRe: User modifiable plots, wanted Pin
Bob Flynn18-May-05 2:03
Bob Flynn18-May-05 2:03 
GeneralRe: User modifiable plots, wanted Pin
stromboli18-May-05 9:25
stromboli18-May-05 9:25 
GeneralRe: User modifiable plots, wanted Pin
Bob Flynn20-May-05 3:22
Bob Flynn20-May-05 3:22 
GeneralHelp with Inheritance Pin
bhangie17-May-05 21:51
bhangie17-May-05 21:51 
GeneralRe: Help with Inheritance Pin
S. Senthil Kumar17-May-05 23:06
S. Senthil Kumar17-May-05 23:06 
In C++, a derived class's constructor calls the base class constructor first before proceeding. In your Crocodile class, you have a constructor that takes two arguments. You haven't called the base class constructor explicitly, so the compiler puts a calls to the base class' default constructor. Because there is no default constructor, the code fails to compile.

You can make it by compile by adding a default constructor to Animal, like
class Animal
{
public:
     Animal() {}
     // Your code here
};


Or you can propagate the call from the derived class to the base class with something like
class Crocodile : public Animal
{ 
public:
    Crocodile(const string &name, const char &sex, const string &Colour, int age,int jaw_size, const string &move_ment) : Animal(name, sex, Colour, age)
    {
    }
};


By the way, I don't think deriving Crocodile from Animal is a good idea. A crocodile is an instance of animal. It's like inheriting Toyota Corolla and Mercedes Benz from Car.

Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
GeneralRe: Help with Inheritance Pin
ThatsAlok17-May-05 23:47
ThatsAlok17-May-05 23:47 
GeneralRe: Help with Inheritance Pin
David Crow18-May-05 2:22
David Crow18-May-05 2:22 
GeneralRe: Help with Inheritance Pin
S. Senthil Kumar18-May-05 5:38
S. Senthil Kumar18-May-05 5:38 
GeneralRe: Help with Inheritance Pin
David Crow18-May-05 6:01
David Crow18-May-05 6:01 
GeneralRe: Help with Inheritance Pin
S. Senthil Kumar18-May-05 6:08
S. Senthil Kumar18-May-05 6:08 
GeneralRe: Help with Inheritance Pin
David Crow18-May-05 8:04
David Crow18-May-05 8:04 
GeneralRe: Help with Inheritance Pin
S. Senthil Kumar18-May-05 20:25
S. Senthil Kumar18-May-05 20:25 
GeneralRe: Help with Inheritance Pin
ThatsAlok17-May-05 23:13
ThatsAlok17-May-05 23:13 
GeneralThanks Pin
bhangie18-May-05 0:08
bhangie18-May-05 0:08 
Generalbulid error Pin
Usman Arif17-May-05 21:30
Usman Arif17-May-05 21:30 
GeneralSerial Port Monitor Pin
sallypeh17-May-05 20:45
sallypeh17-May-05 20:45 
GeneralRe: Serial Port Monitor Pin
Joel Holdsworth17-May-05 22:58
Joel Holdsworth17-May-05 22:58 
GeneralRe: Serial Port Monitor Pin
sallypeh17-May-05 23:12
sallypeh17-May-05 23:12 
GeneralRe: Serial Port Monitor Pin
Adi Narayana Vemuru17-May-05 23:50
Adi Narayana Vemuru17-May-05 23:50 
GeneralC++ problem.. Pin
Anonymous17-May-05 20:24
Anonymous17-May-05 20:24 
GeneralRe: C++ problem.. Pin
Jack Puppy17-May-05 20:45
Jack Puppy17-May-05 20:45 
GeneralRe: C++ problem.. Pin
toxcct18-May-05 0:16
toxcct18-May-05 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.