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 is c++ hash?
Is c++ a low level language?
What is namespace std; and what is consists of?
What is the meaning of string in c++?
What is the use of setprecision in c++?
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?
What is the object serialization?
Please explain the reference variable in c++?
What character terminates all character array strings a) b) . c) END
Why do we use string in c++?
What are the methods of exporting a function from a dll?
What is pointer with example?
What is constant in c++ with example?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
Define private, protected and public access control.