Vim9: support using a protected new() method#16604
Vim9: support using a protected new() method#16604yegappan wants to merge 1 commit intovim:masterfrom
Conversation
|
Can protected constructors be also supported for |
|
Hm, there doesn't seem to be anything special about |
|
Hi @chrisbra
The difference is that the protected new() constructor cannot be called from outside of the class. So an instance of the class cannot be created outside of the class. This can be used to create the singleton class (https://refactoring.guru/design-patterns/singleton). One of the test checks that an instance of the class cannot be created outside of the class. |
4f781ab to
17b46a6
Compare
What is the use case for supporting the protected constructor with |
|
alright thanks! |
|
Exactly, The documentation entry for protected constructors talks As for
|
No description provided.