How to avoid a class from instantiation?

Answer Posted / ravi

We can aviod a class from instantiation by making all
variants of constructors as private. We can provide user
defined function like create member function under public
scope and call this private construcotrs from this create
function to create an object for that class.

Is This Answer Correct ?    3 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of the "delete" operator?

624


What relational operators if statements in c++?

646


Which bit wise operator is suitable for turning off a particular bit in a number?

645


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

569


What is the benefit of learning c++?

555






What do you mean by public protected and private in c++?

604


Write a note about the virtual member function?

607


Explain class invariant.

588


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

1806


What is ios class in c++?

581


Explain linear search.

634


Explain what data encapsulation is in c++?

578


What is main function in c++ with example?

568


What is an incomplete type in c++?

771


How much do c++ programmers make?

567