Question regarding Types and OO

BlitzMax Forums/BlitzMax Beginners Area/Question regarding Types and OO

Fry Crayola(Posted 2005) [#1]
Sorry about the slightly vague title.

Is it entirely possible (with no problems developing at any point) to have a program which creates an instance each of a number of user defined types, calls a function within one of them to get the ball rolling and then leaves all the processing to the individual functions and methods within the types? Then, when the program is ready to end, it finally leaves that function and the main section of code shuts it all down?

It would make things a lot easier from my design point of view, as I could make the individual sections a user defined type that is much easier to manage than a massive selection of functions, even if they are in different files.

I know I can do this in the likes of Java, so is it definitely possible in BlitzMax and are there any potential problems I should be aware of?

Thanks.

(and sorry if I sound like a simpleton... :) )


Rck(Posted 2005) [#2]
If your program consists of a call to a function and everything ends when that function ends, it is ok.

Isn't that what a program can be seen as, anyway?


FlameDuck(Posted 2005) [#3]
Is it entirely possible (with no problems developing at any point) to have a program which creates an instance each of a number of user defined types, calls a function within one of them to get the ball rolling and then leaves all the processing to the individual functions and methods within the types?
Yes. There are a few "gotchas" tho'. For starters all these user defined types must implement the same interface. That is must have identical signitures. In Blitz, you can kinda acheive this by making your base, or super type abstract, with no code implementation at all (except it might be a good place to "get the ball rolling" so to speak).

I know I can do this in the likes of Java, so is it definitely possible in BlitzMax and are there any potential problems I should be aware of?
BlitzMAX doesn't actually support interfaces, even tho' you can fake it well enough.