[Gambas-user] Having an overidden class constructor
Sebi
sebikul at ...626...
Thu Nov 22 18:45:58 CET 2012
In fact, your code is okay, but when creating an instance of a class without arguments you need too skip the parenthesis.
-----Original Message-----
From: laurent bernabe <laurent.bernabe at ...626...>
Date: Thu, 22 Nov 2012 18:42:41
To: mailing list for gambas users<gambas-user at lists.sourceforge.net>
Reply-To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Subject: [Gambas-user] Having an overidden class constructor
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
More information about the User
mailing list