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
What are advantages of using friend classes?
How to give an alternate name to a namespace?
Why is it necessary to use a reference in the argument to the copy constructor?
Is vector a class in c++?
How one would use switch in a program?
What is the benefit of c++?
How do you establish an is-a relationship?
What is isdigit c++?
What is abstract class in c++?
Why are pointers not used in c++?
Do we have to use initialization list in spite of the assignment in constructors?
Is swift better than c++?
What is a map in c++?
How a new element can be added or pushed in a stack?
What do you mean by a template?