[Gambas-user] Static class?!?
Leonardo Miliani
leonardo at ...1237...
Mon Aug 14 21:30:19 CEST 2006
Ron Onstenk ha scritto:
> On Monday 14 August 2006 16:23, Leonardo Miliani wrote:
>> Is it me or is it a Gambas 1.9.38 bug?
>> I cannot create a dynamic class...
>> I add a new class to a project and choose the Constructor option. But
>> when I declare the new class in a form with NEW Gambas tells me that the
>> class is static... but in my class code there is the sub _new()...
>>
>>
>
> Providing the head of your class explains more to find the problem.
>
>
>
Try this:
1) create a new project, i.e. Test
2) create a new class, i.e. Class1, and select the Constructor checkbox
3) the Class1 class must be as follow:
PUBLIC SUB _new()
END
PUBLIC FUNCTION Sum(a AS Integer, b AS Integer) AS Integer
DIM aa AS Integer
aa = a + b
RETURN aa
END
4) in Form1 form add a button named Button1
5) now the Form1 form must be as follow:
PRIVATE csum AS NEW clsSum
PUBLIC SUB Form_Open()
END
PUBLIC SUB Button1_Click()
DIM csum AS NEW clsSum
DIM a, b AS Integer
a = csum.Somma(2, 3)
END
6) execute it
I get this error:
Class 'clsSum' is Static
It's strange.... Am I wrong or is Gambas wrong?
--
Ciao.
Leo
Visita il mio sito personale: www.leonardomiliani.com
e-mail: leonardo at ...1237...
More information about the User
mailing list