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?
Discussion:
104 comments Page 2 of 11.
Harsh Nandal said:
7 years ago
Singleton class is a class that can have only one object/element/instance at a time and is designed to control object creation.
Akshata said:
7 years ago
Singleton class is a class created only one object (instance) at a time.
Rupali said:
8 years ago
Singleton class is a class that can have only one object at a time.
M.SIva Mounika said:
9 years ago
Singleton class is a designed pattern that restricts the instantiation of a class to one object.
Ex: By giving double click on the Application of any video player (Windows,VLC...etc) it will open the Application. if we try to open new application by minimizing previous one, it will display minimized one only, it wont create another new application. Because, It's restricted to the instantiation of a class to only one object.
Ex: By giving double click on the Application of any video player (Windows,VLC...etc) it will open the Application. if we try to open new application by minimizing previous one, it will display minimized one only, it wont create another new application. Because, It's restricted to the instantiation of a class to only one object.
(2)
Anni said:
9 years ago
What is an abstract class?
Describe it.
Describe it.
Shantanu said:
9 years ago
Not getting the meaning of Singleton. Please describe it clearly.
Rajeev said:
9 years ago
Why virtual class not access through any class?
S.jayachitra said:
9 years ago
What is the different between the singleton class and virtual class?
Rahul Thete said:
9 years ago
The Singleton's purpose is to control object creation, limiting the number of obejcts to one only. Since there is only one Singleton instance, any instance fields of a Singleton will occur only once per class, just like static fields. Singletons often control access to resources such as database connections or sockets.
For example, if you have a license for only one connection for your database or your JDBC driver has trouble with multithreading, the Singleton makes sure that only one connection is made or that only one thread can access the connection at a time.
For example, if you have a license for only one connection for your database or your JDBC driver has trouble with multithreading, the Singleton makes sure that only one connection is made or that only one thread can access the connection at a time.
Prema said:
9 years ago
Define singleton class?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers