Re: Inner classes by Anders
Anders
Tue Jul 15 06:42:52 CDT 2008
o = CREATEOBJECT('xx')
DEFINE CLASS xx as Form
ADD OBJECT yy as InnerClass
ENDDEFINE
DEFINE CLASS InnerClass AS Custom
FUNCTION Init
MESSAGEBOX( this.Parent.class )
IF This.ParentClass<>'Xx'
*
ENDIF
ENDFUNC
ENDDEFINE
As you see you can check that that InnerClass is used by the class xx, and
if you like, nobody else.
-Anders
"Lew" <lew@fastmail.fm> wrote in message
news:uHGjSQm5IHA.1420@TK2MSFTNGP06.phx.gbl...
> I'm not sure what an 'inner' class is, but you can't nest class defs. Try:
>
> define class MyClass as Something
> Inner = null
>
> function init
> this.Inner = createo(anotherclass)
> enddef
>
> define classs anotherclass as somethingelse
> enddef
>
>
> "Bamibal" <bamibal@eggs.bacon.spam.gmail.com> wrote in message
> news:c3868$487c6a4d$52d99304$27268@cache60.multikabel.net...
>> Hi all,
>>
>> Is it possible to use inner classes in VFP like in Java? I've been trying
>> to do so, but i haven't got it working yet. Let's say I have this code:
>>
>> DEFINE CLASS MyOuter as Custom
>> InnerObject = NULL
>>
>> PROCEDURE Init
>> THIS.InnerObject = NEWOBJECT("MyInner")
>> ENDPROC
>>
>> DEFINE CLASS MyInner as Custom
>> ...
>> ...
>> ENDDEFINE
>> ENDDEFINE
>>
>> When I run this, I get the message "Class definition MyInner is not
>> found".
>> What am I doing wrong???
>>
>> Thanks!
>>
>> Regards,
>> Bami
>
>