C and C++ Programming Resources | C & C++ Code Example Index





The C++ , Class, Object, Object Oriented: Encapsulation, Inheritance and Polymorphism Sample Codes Index Page


The following links demonstrate the C++ program examples on the C++ object oriented principles. The program examples start from the struct, object and class which demonstrate the encapsulation or abstraction principles. Then, from the class construction the program examples demonstrate the inheritance concept which the created class can be extended, reused and enhanced. In order to provide a generic class that can support multiple types, the C++ classes can be design to be polymorphic. There are many terms introduced in this object oriented programming.


The C++ Class and Objects for Object Oriented Programming Examples



  1. The polymorphism in C++ programming: the virtual function of the base class

  2. The base class virtual function of the C++ polymorphism object oriented programming code sample

  3. C++ object oriented programming, the polymorphism without the virtual function code sample

  4. Displaying some data to demonstrate the use of the base class virtual function in C++ programming

  5. Using the pointer variables for class object instantiations and omitting the virtual keyword for C++ polymorphism code sample

  6. Displaying some data to demonstrate the use of the non-pointer variables for object instantiations  and the virtual function in the C++ programming

  7. The C++ polymorphism: assigning the derived (inherited) class object to the base class object code sample

  8. The C++ function template with the overloaded types C++ code sample

  9. How to use the C++ class template in C++ programming

  10. The C++ multi-inheritance where a derived class inherited from two base classes code example

  11. The single and multi-inheritance C++ program example: constructing the a simple family inheritance

  12. The C++ multi-inheritance with variable and function overloading program example

  13. How to override the base class variables and overloading the base class function/method for C++ multi inheritance in C++ programming

  14. C++ multi-inheritance code example demonstrating the variable overriding and function/method overloading of the derived/inherited class

  15. The C++ with class inheritance demonstrating the constructor and destructor execution flow, function/method overloading and the use of private, protected and public keywords

  16. The C++ program example on how to use the friend keyword to access the private and protected class member

  17. The C++ class inheritance with an array of object instantiations C++ code example

  18. Accessing and displaying the base and derived/inherited class for C++ class inheritance programming

  19. How to use the default constructors data and override constructors data in derived/inherited and base classes in C++ public inheritance programming

  20. The C++ private class inheritance of the derived/inherited program example

  21. The private inheritance of the derived class with protected base class member variable C++ code example

  22. Using the private base class member variables with public class inheritance C++ program example

  23. The protected base class member variables and public inheritance C++ code sample

  24. A very simple family structure tree using the C++ inheritance program example

  25. A very simple C++ class object inheritance program example showing the default classes constructors and destructors

  26. The multiple classes which derived from the multiple base classes (multiple inheritance) C++ object oriented program development

  27. The C++ class inheritance:  A simple C++ project development process

  28. Using the default methods supplied by the class C++ program example

  29. The C++ operator and function overloading for complex number program example

  30. The C++ class object, arrays, operator overloading, copy constructor and friends keyword program example

  31. Using the C++ new and delete keywords for class object code example

  32. The C++ class and object with constructor and destructor execution order code example

  33. The C++ function overloading class object program example with several different signature

  34. The C++ operator overloading program example with class object

  35. The C++ nested class object, accessing and using method in other class C++ code example

  36. The C++ class object and link list program example

  37. The C++ class object and link list program example

  38. How to use the hidden C++ 'this' pointer explicitly in C++ programming

  39. The C++ class object and some link list program example

  40. The C++ dynamically allocated class object program example

  41. Using the C++ pointer to class object with new and delete keywords C++ code sample

  1. The C++ class, object, pointer, overloading and string C++ program example

  2. The C++ class object and array type program example

  3. A very simple C++ class program example

  4. Using the C++ class constructor and the overridden values code example

  5. How to create a simple class object in C++ programming stage 1

  6. How to create a simple class object in C++ programming stage 2, adding more functionalities

  7. How to create a simple class object in C++ programming stage 3, adding even more functionalities

  8. Packaging the C++ class: creating a simple C++ class library

  9. The C++ class object: using the default (constructor) and overridden values C++ code example

  10. Now just C++ class, object, constructor and destructor code sample

  11. Solving the struct type problem using class, C++ code sample

  12. Using struct aggregate data type that exhibits some problem for the instantiated objects in C and C++

  13. Changing struct to class, an object construction and the normal variable C++ code example

  14. A very simple C++ program example demonstrating the struct type usage


C and C++ Programming Resources | C & C++ Code Example Index | C Code Example Index