Sign in to follow this  
PREDATOR_UK

Class Detection and Selection

Recommended Posts

PREDATOR_UK    102
OK so i'm working on a programming project and for it I have to use a custom class,

After an object of the class has been created it needs to be added to something like an array where I can access it and get its personalized properties back

Is this possible ?

Thanks

Share this post


Link to post
Share on other sites
Juliean    7077
What languege are you using? Of course this is possible, but it really depends on the languege. In C++ for example you could use [url="http://www.cplusplus.com/reference/stl/vector/"]std::vector[/url] or [url="http://www.cplusplus.com/reference/stl/map/"]std::map[/url] to achieve this.

Share this post


Link to post
Share on other sites
PREDATOR_UK    102
Ok after some research I found some stuff out so I thought I would share it:

Say banana is your custom class.

Dim bananasgroup(10) as banana
banana(0).juicy = 1
banana(3).juicy = 3

Then to save this array...

For each i as new banana in bananasgroup
Save(i.juicy)
next i

Where save is your function, hope this clears some stuff up, it certainly did for me :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this