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
    Location
    Waterloo, Texas
    Posts
    5,600
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  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