Re: How to make an attribute of the oject visible outside of the class [message #56228] |
Fri, 12 October 2007 16:54 |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
natha wrote:
> Hi people,
> If I have an object like this:
> PRO objectA__define
> struct = { objectA, $
> a:0L $
> }
> END
> and another object like this:
> PRO objectB__define
> struct = {objectB, $
> A:OBJ_NEW(objectA) $
> }
> END
>
> How can I do for in a method in the class objectB treat with
> self.A.a ??? Is it possible?
> My code is more complex that this example and for the moment I resolve
> this problem using pointers..
>
> I'm grateful for any suggestions
>
> bye
>
You have 2 options...
1) object B inherits from object A, so all attributes and methods of A
are available for B
struct = {objectB, $
A:OBJ_NEW(objectA) $
INHERITS A
}
2) create a method in object A that returns the variable you want, then call
print, self.A -> return_a()
and if needed, another one to write the value a
self.A -> write_a, newValue
Jean
|
|
|