classes in vbscript

Discussion in 'ASP General' started by Roy Danon, Mar 30, 2005.

  1. Roy Danon

    Roy Danon Guest

    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.
     
    Roy Danon, Mar 30, 2005
    #1
    1. Advertising

  2. Roy 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"
     
    Bob Barrows [MVP], Mar 30, 2005
    #2
    1. Advertising

  3. Bob 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"
     
    Bob Barrows [MVP], Mar 30, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David

    Classes within classes

    David, Jul 21, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,952
    David
    Jul 22, 2005
  2. lonelyplanet999
    Replies:
    1
    Views:
    2,226
    VisionSet
    Nov 13, 2003
  3. Carfield Yim
    Replies:
    1
    Views:
    1,438
    Andrew Thompson
    May 31, 2004
  4. Razvan
    Replies:
    11
    Views:
    921
    Andrew Thompson
    Jul 17, 2004
  5. Razvan
    Replies:
    5
    Views:
    11,310
    Dale King
    Jul 27, 2004
Loading...

Share This Page