Showing posts from March, 2022Show all

6) Write a C++ program on private Constructor.

source file name: privateconst.cpp // CPP program to demonstrate usage of private constructor #include <iostream.h> //using namespace std; // class A class A{ private: A(){ cout << "constructor of A\n"; } friend class B; }; // class B, friend of class A class B{ public: B(){ A a1; …

Read more