C++ Class Inheritance

C++ examples for Class:Inheritance


Click the following links for the tutorial for Class and Inheritance.

  1. Calling functions with base class pointers
  2. Deriving the point3d class from the point2d class
  3. Demonstrate an inheritance where subclass constructor passes argument information to base constructor
  4. Using virtual inheritance to share a common base
  5. Adding Virtual Inheritance, in multiple inheritance
  6. A single class can inherit from more than one base class
  7. Deriving One Class from Another
  8. Specifying the Access Levels of the Inherited Members

  9. Overriding and Returning a Derived Class
  10. Deriving from Two Different Classes
  11. Cracking up Diamonds in class hierarchy
  12. Constructors and Destructors during inheritance
  13. Private Versus Protected during inheritance
  14. To create a class that inherits from another class
  15. Virtual Copy Constructors
  16. Virtual function magic only operates on pointers and references.

  17. Controlling Access to Member Variables and Methods in Derived Classes, public Access Specifier
  18. Inheriting from a Class
  19. The virtual keyword allows you to create methods that can be overridden by derived classes.
  20. Hiding Methods in Derived Classes
  21. Multiple Inheritance with pure virtual parent
  22. Point a derived-class pointer at a base class
  23. Point base-class and derived-class pointers at base-class and derived-class objects, respectively.
  24. Multiple Inheritance
  25. Implementations of the Lion, Fish class and classes derived from Animal
  26. Who() function from base class has the protected access specifier, the derived classes can public access the who() function.
  27. Creating length objects
  28. Defining and using a derived class
  29. Applying a using declaration to restore public access for inherited member
  30. Destructors in a class hierarchy
  31. Using a derived class copy constructor
  32. Calling base class constructors in a derived class constructor
  33. Behavior of inherited functions in a derived class
  34. Overloading functions in base and derived classes
  35. Multiple inheritance with Employees
  36. Inheritance using English Measures
  37. Multiple inheritance with English Measures
  38. Demonstrate ambiguity in multiple inheritance
  39. Constructors in derived class
  40. Investigates diamond-shaped multiple inheritance
  41. Inheritance with Counter class
  42. Models Employee database using inheritance
  43. Multiple levels of inheritance
  44. Ambiguous reference to base class
  45. Publication class and derived classes
  46. Inheritance from String class
  47. Multiple inheritance with publication class