R.Wieser
2016-05-21 19:18:59 UTC
Hello all,
I've created a two vbs classes that are supposed to be a parent and a child
(mimicing WinSock and a created socket). When instanciating a child it
needs a specific property from its parent to be able to function (a handle
to an outside OCX object to do the actual work).
The problem is that I do not see a way to have the child either
automatically inherit that property, or to make it only instanciable by its
parent.
For the first I can ofcourse instanciate the child in the parent, and than
call a "property set" to transfer a property from the parent to the child,
but it does not stop anyone from instanciating a child-object directly
(which than would be useless), or to call that "property set" themselves
(although a bit of a "set only once" logic could be applied, it would be
hackish)
I've also tried to embed the child class in its parent, but alas, that
caused a compile-time (syntax) error.
Any other ideas ?
Regards,
Rudy Wieser
I've created a two vbs classes that are supposed to be a parent and a child
(mimicing WinSock and a created socket). When instanciating a child it
needs a specific property from its parent to be able to function (a handle
to an outside OCX object to do the actual work).
The problem is that I do not see a way to have the child either
automatically inherit that property, or to make it only instanciable by its
parent.
For the first I can ofcourse instanciate the child in the parent, and than
call a "property set" to transfer a property from the parent to the child,
but it does not stop anyone from instanciating a child-object directly
(which than would be useless), or to call that "property set" themselves
(although a bit of a "set only once" logic could be applied, it would be
hackish)
I've also tried to embed the child class in its parent, but alas, that
caused a compile-time (syntax) error.
Any other ideas ?
Regards,
Rudy Wieser