inheritance from classes own members?

This is a discussion on inheritance from classes own members? within the C++ Programming forums, part of the General Programming Boards category; Reading about Inheritance I don't quite understand the following Code: Mammal::Mammal(): itsAge(1), itsWeight(5) { cout << "Mammal constructor...\n"; } My ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    4

    inheritance from classes own members?

    Reading about Inheritance I don't quite understand the following

    Code:
    Mammal::Mammal(): itsAge(1), itsWeight(5)
    {
    cout << "Mammal constructor...\n";
    }
    My question is, what is realy going on here? itsAge and itsWeight are both member variables of the Mammal class. Is this Inheritance and why would a class try to inherit from itself?

    Can someone please explain?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Posts
    5,439
    Code:
    int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000
    <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan
    (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000
    )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    4

    Thank you

    Thanks that fully explains it, and thanks to Cat for the origional answer.

    I had searched prior to posting but could only find inheritance from base classes and nothing such as this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. templated members in non-template classes
    By drrngrvy in forum C++ Programming
    Replies: 3
    Last Post: 04-07-2007, 01:38 PM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 08:04 AM
  3. Class with members as classes
    By justdoit22 in forum C++ Programming
    Replies: 8
    Last Post: 12-29-2003, 05:58 PM
  4. Inheritance Classes w/ same function name
    By Diamonds in forum C++ Programming
    Replies: 3
    Last Post: 03-11-2003, 12:11 AM
  5. Help with classes & strings members
    By GrNxxDaY in forum C++ Programming
    Replies: 7
    Last Post: 07-21-2002, 08:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21