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


Please Help Members By Posting Answers For Below Questions

What is the two main roles of operating system?

598


What are enumerations?

745


What is the maximum combined length of command line arguments including the space between adjacent arguments?

667


What are the advantages of c++? Explain

681


What is enum class in c++?

790






How many types of modularization are there in c++?

667


Is c++ primer good for beginners?

675


Do the parentheses after the type name make a difference with new?

748


Is it possible for the objects to read and write themselves?

743


What is meant by forward referencing and when should it be used?

653


daily Routine of father

1014


Explain the virtual inheritance in c++.

691


Mention the storage classes in c++.

739


Which format specifier is used for printing a pointer value?

666


What is the protected keyword used for?

724