How would you stop a class from class from being derived or
inherited?The constructer should not be Private,as object
instantiation should be allowed.
Answer Posted / mms zubeir
Thanks for your detailed answer. It's good to see you have
achieved the purpose partially by using static methods.
Still, we cannot create objects on the stack rather it
allows to create objects only on the heap. This is because,
we have to call the destructor using delete. You have
provided static methods to do that.
The compiler will not allow to create stack objects since
it cannot be able to invoke the destructor when unwinding
stack.
I do not have an idea how to fulfill this requirement.
Anyway, you have rolled out the solution to some extent.
Thanks.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to tokenize a string in c++?
What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?
What is a literal in c++?
What is the arrow operator in c++?
How do you save a c++ program?
What is the difference between interpreters and compilers?
Will rust take over c++?
Which software is used for c++ programming?
How does the copy constructor differ from the assignment operator (=)?
What is c++ library?
What are pointers used for c++?
In the derived class, which data member of the base class are visible?
How one would use switch in a program?
Is c++ vector dynamic?
What is difference between rand () and srand ()?