Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, i'm trying to create a class which one of its properties is another class. this is what i'm basicly trying to do : public bbb public aaa end class class bugi public ccc as new subbugi public ddd end class set a=new bugi a.ccc.aaa="ds" the problem is that for somereason this doesn't work. any solutions? Roy.
Post Follow-up to this messageRoy Danon wrote: > Hi, > i'm trying to create a class which one of its properties is another > class. > > > this is what i'm basicly trying to do : > > public bbb > public aaa > end class > > class bugi > public ccc as new subbugi This is not legal in vbscript where all variables are variants. Besides, I don't see where the subbugi class is defined. Are we supposed to assume it's defined somewhere? Oh wait! Was "public bbb" supposed to be "class subbugi"? If so, this may work: private _ccc public Property Get ccc set ccc=_ccc End Property Private Sub Class_Initialize Set _ccc=New subbugi End Sub > public ddd > end class > > set a=new bugi > a.ccc.aaa="ds" > > > the problem is that for somereason this doesn't work. > any solutions? > What does "doesn't work" mean? Error messages? Machine freezes? Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Post Follow-up to this messageBob Barrows [MVP] wrote: > If so, this may work: > > private _ccc > public Property Get ccc > set ccc=_ccc > End Property > Private Sub Class_Initialize > Set _ccc=New subbugi > End Sub > > Hmm, I overthought that one. This should be all that you need: Public ccc Private Sub Class_Initialize Set ccc=New subbugi End Sub Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.