Type Here to Get Search Results !

What is a "singleton" pattern in OOP?

0

 What is a "singleton" pattern in OOP?

A) A design pattern that restricts a class to a single instance.
B) A method for handling multiple instances of a class.
C) A type of factory pattern.
D) A pattern that allows for multiple inheritance.

Answer: A) A design pattern that restricts a class to a single instance.

Explanation: The singleton pattern is a design pattern that ensures a class has only one instance and provides a global point of access to it. This is often used in cases where a single instance is required to coordinate actions across the system, such as in configuration settings or logging.

Post a Comment

0 Comments