[Gambas-user] class within a class with a key
Mayost Sharon
sharon at 455.co.il
Fri Apr 14 17:18:15 CEST 2023
---------- Original Message -----------
From: Bruce Steers <bsteers4 at gmail.com>
To: Gambas Mailing List <user at lists.gambas-basic.org>
Sent: Fri, 14 Apr 2023 14:56:09 +0100
Subject: Re: [Gambas-user] class within a class with a key
> On Fri, 14 Apr 2023 at 13:55, Mayost Sharon <sharon at 455.co.il> wrote:
>
> > Hello
> > I need help on how to make a class within a class
> > Attached is an example that gives me an error because I'm missing
> > something that I can't figure out what to do
> >
> > I want to reach a state of:
> > Print gb_Class1.students["key_01"].student_01
> > Print gb_Class1.students["key_01"].student_02
> >
> >
> > Thank you
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
>
> to use Keys like a collection you need to use Collection datatype.
> Your Class2.class is not coded to work like a collection with Keys so it
> does not work as you expect.
>
> I got your code working by making the Class1.class $students a collection
> of Class2 objects.
> Class2.class has no functions just the student_01 student_02 properties.
>
> BruceS
------- End of Original Message -------
First of all thank you very much
1.
When I type "." In the end so that it completes
gb_Class1.students.
This completes a collection list
I wanted it to complement only what is in class 1
.Add
.students
2.
When I type "." In the end so that it completes
gb_Class1.students["key_01"].
It does not complete anything
Because it understands that it is a Variant variable
I wanted it to complement only what is in class 2
.student_01
.student_02
More information about the User
mailing list