[Gambas-user] protected for a variable inherited from a class

Jussi Lahtinen jussi.lahtinen at gmail.com
Fri Apr 21 20:32:30 CEST 2023


>
> 1. You seem to be what you were seemingly to achieve through:
> Static Public Function GetPrivate() As Integer
> (that doesn't work either)
>

Like Lee said, change the iVar declaration to static and then it is
possible.


2. In your example, still when I register hObj1 and a period in the IDE, it
> completes me and shows me that there is a GetPrivate method. I'm looking
> for a way that it won't show it to me when I create an instance of CLASS1
> but when I'm in CLASS2 which is an inheritance of CLASS1 so Inside it will
> be possible to access CLASS1.GetPrivate
>

I guess there is some language barrier issue. I don't really understand
what you are trying to achieve.
If you have static access to class1 function (class1.GetPrivate), then you
will have dynamic access also (hObj.GetPrivate, where hObj is an instance
of class1).
There doesn't seem to be a way to detect this in Gambas.

If you don't want a function of class1 to be accessed, then why is the
function in class1? Why not in class2?


Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230421/bb351b96/attachment.htm>


More information about the User mailing list