Check out example codes for "container class in c++". It will help you in understanding the concepts better.

Code Example 1

// CPP program to illustrate 
// concept of Containership 
  
#include <iostream> 
using namespace std; 
  
class first { 
public: 
    void showf() 
    { 
        cout << "Hello from first class\n"; 
    } 
}; 
  
// Container class 
class second { 
    // creating object of first 
    first f; 
  
public: 
    // constructor 
    second() 
    { 
        // calling function of first class 
        f.showf(); 
    } 
}; 
  
int main() 
{ 
    // creating object of second 
    second s; 
}

Learn ReactJs, React Native from akashmittal.com