dir.by  
Поиск >>

Компьютер, программы
→
Patterns, Design Patterns | OOP Principles | Code refactoring
 Одиночка (Singleton) это порождающий шаблон проектирования 
посмотрели 4124 раз
обновлено: 30 March 2021
Одиночка это паттерн, который гарантирует, что для определенного класса будет создан только один объект.
Пример
  C#  
class AppVersion
{
     private static AppVersion _instance;

     private AppVersion()
     {}

     public static AppVersion getInstance()
     {
          if (_instance == null)
               _instance = new AppVersion();
          return _instance;
     }
}
 
← Previous topic
The Abstract Factory is a generative design pattern
 
Next topic →
Prototype is a generative design pattern
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

Новость "Черная пятница" Dreame в Беларуси – две недели скидок до 3400 рублей
 
Introduction
• What is a subclass or child class or descendant of a class? What is a parent class?
Principles of OOP
• What is Object-Oriented Programming? Principles: abstraction, encapsulation, inheritance, polymorphism
Code refactoring
• What is code refactoring?
Design patterns
Generative patterns
• The Factory Method is a generative design pattern
• The Abstract Factory is a generative design pattern
• Singleton is a generative design pattern
• Prototype is a generative design pattern
• The Builder is the generative design pattern
<BR>
Patterns of behavior
• Strategy is a behavioral design pattern
S.O.L.I.D. (5 principles of program design)
• What is SOLID?
• Single Responsibility Principle SOLID Design
• Open/Closed Principle SOLID Design

  Ваши вопросы присылайте по почте: info@dir.by