inheritance or polymorphism

This is a discussion on inheritance or polymorphism within the C++ Programming forums, part of the General Programming Boards category; the movement behavior of the mammals - Bat and Whales, exhibits which of the following (inheritance or polymorphism)...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    3

    inheritance or polymorphism

    the movement behavior of the mammals - Bat and Whales, exhibits which of the following (inheritance or polymorphism)

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,457
    What do you think, and why? (Frankly, both can be correct depending on the situation, so the why determines if you have the right idea.)
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    3
    i think poly coz the statement refer to the movement.....but most of my friends said inheritance..im very confuse this question is going to come out tomorrow on my exam paper... need ur help what do you think...?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,457
    Well, put it in another way: given this problem, would you create a hierarchy of mammals, or a hierarchy of movements? If it is the former, then you would answer polymorphism. If it is the latter, then you would answer inheritance.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    3
    thanks a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. polymorphism and inheritance
    By stewie griffin in forum C++ Programming
    Replies: 12
    Last Post: 01-16-2009, 01:45 AM
  2. Replies: 8
    Last Post: 01-13-2008, 04:57 PM
  3. Polymorphism, inheritance and containers
    By musicalhamster in forum C++ Programming
    Replies: 6
    Last Post: 11-27-2007, 09:23 AM
  4. Inheritance and Polymorphism
    By bench386 in forum C++ Programming
    Replies: 2
    Last Post: 03-18-2004, 09:19 PM
  5. inheritance and polymorphism uses...
    By tetra in forum C++ Programming
    Replies: 5
    Last Post: 05-06-2003, 05:30 PM

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