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
To what does “event-driven” refer?
What is the c++ code?
What is wrapper class in c++?
What's the order in which the local objects are destructed?
What is the sequence of destruction of local objects?
What are the various storage classes in C++?
What is an inclusion guard?
Does c++ have string data type?
Explain how the virtual base class is different from the conventional base classes of the opps.
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include What is encapsulation in c++ with example? What is namespace std; and what is consists of? what Is DCS ? what i will get benefit when i did? Write a function to find the nth item from the end of a linked list in a single pass. What is the difference between public, private, and protected access?