Check out example codes for "cpp language explained". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
using namespace std;
class BaseClass {
   void disp(){
      cout<<"Function of Parent Class";
class DerivedClass: public BaseClass{
   void disp() {
      cout<<"Function of Child Class";
int main() {
   /* Reference of base class pointing to
    * the object of child class.
   BaseClass obj = DerivedClass(); 
   return 0;

Learn ReactJs, React Native from