C++ inheritance

This is a discussion on C++ inheritance within the C++ Programming forums, part of the General Programming Boards category; lets say i have base class a and class b is inheriting class a. in class a we have a ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    58

    C++ inheritance

    lets say i have base class a
    and class b is inheriting class a.

    in class a we have a function called convert().in convert we create a object of type b.

    Is this correct?

    It compiles and runs in dev C++..but wanted to know from programming point of view..correct or wrong

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,264
    Probably wrong, since base classes typically should know nothing about their derived classes, but it may also be the case that you are using b as if it has no inheritance relationship with a. What is convert() supposed to do?
    Last edited by laserlight; 04-05-2009 at 11:29 PM.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 04:03 PM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM
  3. inheritance and performance
    By kuhnmi in forum C++ Programming
    Replies: 5
    Last Post: 08-04-2004, 01:46 PM
  4. Inheritance and Polymorphism
    By bench386 in forum C++ Programming
    Replies: 2
    Last Post: 03-18-2004, 10:19 PM
  5. Inheritance vs Composition
    By Panopticon in forum C++ Programming
    Replies: 11
    Last Post: 01-20-2003, 04:41 AM

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