Can we have a private constructor ?

Answer Posted / ashwini

Yes, We can.
By doing so, we can create only single instance of the
class.(singleton)

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are two types of polymorphism?

801


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1738


What is object in oop?

874


What is destructor example?

770


What is inheritance and how many types of inheritance?

811


can inline function declare in private part of class?

3963


What does I oop mean?

828


Write a program to reverse a string using recursive function?

2021


Can destructor be overloaded?

795


Whats oop mean?

787


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1966


What is the point of oop?

854


What are the benefits of polymorphism?

855


Why multiple inheritance is not possible?

794


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

2054