IonicWind Software

IWBasic => Object Oriented Programming => Topic started by: definitelyokay on August 25, 2009, 08:42:21 AM

Title: Simple Class Questions
Post by: definitelyokay on August 25, 2009, 08:42:21 AM
Been using Emergence BASIC, and I like it a lot. ;D

However, I've run into a couple of questions with the OOP side of it.

Can you have a constructor that takes parameters? If so, how do you go about it that with the NEW command?

Is it like "Def X As New(xObject(param1, param2), 1)"?

And, how do you call a sub in a class from another sub in the same class. Do I need to use Object::SubName as usual?

I've been really studying the help file, but I seem to have gotten stuck on OOP up at this point.

Any help would be great! Thanks,

Joseph
Title: Re: Simple Class Questions
Post by: LarryMc on August 25, 2009, 11:40:05 AM
QuoteAnd, how do you call a sub in a class from another sub in the same class. Do I need to use Object::SubName as usual?

No, you can just use the sub name by itself.

Larry
Title: Re: Simple Class Questions
Post by: definitelyokay on August 25, 2009, 11:50:28 AM
Thanks Larry! ;D

I guess you can't have a constructor with parameters, doesn't seem to work. So I just made another method...
Title: Re: Simple Class Questions
Post by: LarryMc on August 25, 2009, 01:55:45 PM
The way I think of constuctors/destructors, right or wrong, is the places where I initialize all my member variables and then cleanup memory when I'm through.

Larry