How to avoid a class from instantiation?

Answer Posted / rsn

Yes, I agree with Ravi. Classes can be prevented from
instantiating and also from getting inherited using provate
constructors. The initialisation can be done using member
functions in which case it is called "clone" functions(I
hope so, Pls correct me if i'm wrong!).

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What parameter does the constructor to an ofstream object take?

607


Why c++ is created?

572


Can a program run without main?

622


Explain virtual class and friend class.

595


Write a recursive program to calculate factorial in c++.

605






Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3694


Is set c++?

565


Why are arrays usually processed with for loop?

770


What is data hiding c++?

597


What is size of string in c++?

550


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

538


Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()

1003


Define anonymous class.

621


What is vector processing?

663


What is the full form of c++?

613