I'm currently using a class which members I want to be the same across the whole program. So I need to disable the use of constructor of this class. What is the best way of doing that ?
- Declare the constructor private
- constructor() = delete;
I'm currently using a class which members I want to be the same across the whole program. So I need to disable the use of constructor of this class. What is the best way of doing that ?
Write the code that best explains what you're doing. If you want the class to be privately constructible, make the constructor private
. If you want nobody to be able to construct the class, then delete
the constructor.