Another Tuesday (Friday?), Another GtkDcoding Blog Post
number
putimalitze at gmx.de
Fri Mar 22 13:58:48 UTC 2019
On Tuesday, 12 March 2019 at 14:44:59 UTC, Ron Tarrant wrote:
>
As a side note, in 0004 you say:
> We can still call the constructor, even though strictly
> speaking it’s private, because by using ‘new MyButton()’ the
> constructor isn’t being called directly, but as part of a
> lower-level process for instantiating the object.
I'm still new to D too, but I think it works in this scenario
because private in D works on the module/file level.
main/TestRigWindow/MyButton are defined in the same file (module)
and thus can access each others private members. If you put the
button class in its own file/module and import it then you would
have to make its constructor public to access it.
> button_002_04_oop_arg.d(22): Error: class
> `button_002_04_oop_arg_2.MyButton` member this is not accessible
More information about the Digitalmars-d-learn
mailing list