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

C / C++ / MFC

 
Generalgetting and displaying icons... Pin
Mridang Agarwalla17-May-05 22:03
Mridang Agarwalla17-May-05 22:03 
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 
Hi there

Below is the code i have written, is there something wrong
with my derived class? i am getting a compiler error :No default Constructor available for the Animal class.
Or is it the base class ,

<br />
class Animal<br />
{<br />
    public:<br />
        Animal(const string &name, const char &sex, const string &Colour, int age);<br />
        ~Animal();<br />
        <br />
        //get amount of food for specific animal<br />
        int feed_animal(const int &);<br />
        <br />
        void display_Info() const;<br />
        <br />
        private:<br />
            string aName;<br />
            char   aSex;<br />
            string aColour;<br />
            int    aAge;<br />
};<br />
<br />
class Crocodile     : public Animal<br />
{<br />
    public:<br />
        Crocodile(int jaw_size, const string &move_ment);<br />
        ~Crocodile();<br />
        <br />
        private:<br />
            int jaw;<br />
            string move;<br />
            <br />
};<br />
<br />
Animal::Animal(const string &name,const char &sex, const string &Colour, int Age)<br />
:aName(name), aSex(sex), aColour(Colour), aAge(age)<br />
{<br />
    //Empty Constructor<br />
}<br />
<br />
Animal::~Animal()<br />
{<br />
}<br />
<br />
int Animal::feed_animal(const int &food)<br />
{<br />
    return food;<br />
}<br />
<br />
void Animal::display_Info() const<br />
{<br />
    cout << "Name   : " << aName << endl;<br />
    cout << "Sex    : " << aSex << endl;<br />
    cout << "Colour : " << aColour << endl;<br />
    cout << "Age    : " << aAge << endl;<br />
}<br />
                <br />
<br />
int main(int argc, char *argv[])<br />
{<br />
    Animal Crocko("American Aligator", 'M', "Dark Grey", 2);<br />
    Crocko.feed_animal(25); //In kilograms or grams<br />
    Crocko.display_animal();<br />
    <br />
  <br />
  return 0;<br />
}<br />


thanks in advance

Bhangie


Education begins a gentleman,
conversation completes him Wink | ;)
GeneralRe: Help with Inheritance Pin
S. Senthil Kumar17-May-05 23:06
S. Senthil Kumar17-May-05 23:06 
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 

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.