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
Can you pass an array to a function in c++?
Explain what happens when a pointer is deleted twice?
What is basic if statement syntax?
How do I use arrays in c++?
What is the most useful programming language?
What is class in c++ with example?
What is the prototype of printf function?
Define whitespace in C++.
What is the difference between a reference and a pointer?
Is map ordered c++?
Explain the use of vtable.
What is vector pair in c++?
What is string in c++ programming?
What are the defining traits of an object-oriented language?
What are pointer-to-members? Explain.