C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 1)
1.
Which of the following type of class allows only one object of it to be created?
Virtual class
Abstract class
Singleton class
Friend class
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
104 comments Page 8 of 11.

Sima said:   1 decade ago
I cannot understand the concept of singleton class I think it can be virtual class.

Soori said:   1 decade ago
Nice example @Rajeesh.

Divya said:   1 decade ago
In singleton class, what about the variable. Is there we use private constructor?

Pradeep Kumar said:   1 decade ago
How can we say the given class is singleton not?

Hari Narayanan said:   1 decade ago
If it is singleton, explain others?

Aparna said:   10 years ago
Singleton set is used for only one instance of the class.

Singleton means only one instance or object at a time can be created.

Singleton set example:

public class singleton();
{
private static singleton instance;
private singleton()
{

}

Public static singleton instance (this is one and only one way to obtain any instance of the singleton set).
{
get
{
if(instance==null)
{
instanece = new singleton(); (memory will be allocated only on first call to the 'instance' property)
}
return instance;
}
}

Davis said:   10 years ago
Only single class can be inherited, no multiple inheritance can take place here.

Varsha said:   10 years ago
Please explain in this question in details.

Raj said:   10 years ago
What is friend class? Explain?

Shri said:   9 years ago
I too didn't understand this singleton class.


Post your comments here:

Your comments will be displayed after verification.