Create a class and set values to the private data members using a default, parameterized and copy constructor in C++.
This is an example of C++ constructors, here we have a class named person and private data members name and age. In this example, we will set values to name and age through the default, parameterized and copy constructors.
Here, we will create three objects p1, p2 and p3. p1 will be initialized with a default constructor, p2 will be initialized with a parameterized constructor and p3 will be initialized with the copy constructor.