[Gambas-user] Having an overidden class constructor

laurent bernabe laurent.bernabe at ...626...
Thu Nov 22 18:42:41 CET 2012


Hello,

I am coding a Vector3f class (representing a Mathematical vector), and I
would like that instances of this class can be made from two ways :

   - either by calling New Vector3f() for a vector located at the origin
   (0,0,0)
   - or by supplying 3 arguments, such as with New Vector3f(1,2,-3)

In my source file (Vector3f.class) : I designed the _new procedure by
giving 3 optionnal float.

But when I call (In MMain.module) New Vector3f(), I get the error
"Unexpected ')' at line 20".

So, did I misunderstand optionnal parameters ?

Thank in advance
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ColoredCube.module
Type: application/octet-stream
Size: 1177 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121122/80187718/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MMain.module
Type: application/octet-stream
Size: 2749 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121122/80187718/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Vector3f.class
Type: application/octet-stream
Size: 1676 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121122/80187718/attachment-0002.obj>


More information about the User mailing list