mirror of
https://github.com/vim/vim
synced 2025-05-02 22:37:47 +02:00
Support for protected constructors was added in commit 7e89800
.
closes: 16618
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
19 lines
283 B
VimL
19 lines
283 B
VimL
vim9script
|
|
|
|
# Vim9 constructor
|
|
|
|
|
|
class A
|
|
static var _instance: A
|
|
var str: string
|
|
def _new(str: string)
|
|
this.str = str
|
|
enddef
|
|
static def GetInstance(str: string): A
|
|
if _instance == null
|
|
_instance = A._new(str)
|
|
endif
|
|
return _instance
|
|
enddef
|
|
endclass
|
|
|