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
Do you know about latest advancements in C++ ?
Can member functions be private?
What is else if syntax?
Should I learn c or c++ or c#?
What is the use of map in c++?
How the programmer of a class should decide whether to declare member function or a friend function?
Which one between if-else and switch is more efficient?
What is the difference between public, private, and protected access?
What is the role of C++ shorthand's?
Is c++ a low level language?
How can you quickly find the number of elements stored in a dynamic array?
Explain the use of this pointer?
what are the events occur in intr activated on interrupt vector table
What is boyce codd normal form in c++?
What do you mean by ‘void’ return type?