If the constructor/destructor is declared as private, then the class cannot be instantiated. This is true, however it can be instantiated from another method in the class. Similarly, if the destructor is private, then the object can only be deleted from inside the class as well. Also, it prevents the class from being inherited (or at least, prevent the inherited class from being instantiated/destroyed at all).
Можешь но тогда нельзя будет создать объект
Обсуждают сегодня