Redeclaring data members in extended types

BlitzMax Forums/BlitzMax Programming/Redeclaring data members in extended types

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Basically New B.Create(10) creates an instance of B and immediately calls the Create() method. Since the method returns Object, then you need to cast it to B with B(). So that gives you B(New B.Create(10)). You could define the Create() method to return B, so there is no need to cast, but unfortunately, since BlitzMax doesn't allow overloading, you would need to return B for every base type and extended type as well (unless you wanted a CreateA:A(), CreateB:B(), etc...).

It's really just a matter of preference and style. If I don't need to call base class Create()'s, I would just use a Create Function instead of a method like in Brucey's example.