[Gambas-user] INHERITS
ron
ronstk at ...239...
Tue Apr 13 17:56:15 CEST 2004
On Tuesday 13 April 2004 09:14, Dimitri Bellini wrote:
> Dear All
> thanks for your reply and i hope have passed a good easter holiday.
> I have try to understand the "INHERITS" function so i create a new Class
> file Called XTimer and i add this line:
> ----
> ' Gambas class file
> INHERITS {Timer}
>
> PRIVATE tag AS Integer
>
> PUBLIC Name AS String
>
> PUBLIC SUB _new(sName AS String)
> Name = sName
> END
> ------
>
> and i call it from my main form like it:
>
> -----
> tmr=NEW XTimer("XTimer", FMain) AS "tmrCab"
> tmr.tag=i
> -----
>
> But when i run the Program i have a mex that say " XTimer.tag is not
> property" Thanks in advance
> Dimitri
He that is quick learning. Good part sofar.
Change
--------
> PRIVATE tag AS Integer
to
property tag as integer 'need read and write
private m_tag as integer
>
> PUBLIC Name AS String
to
property read name as string 'need read only
private m_name as string
> PUBLIC SUB _new(sName AS String)
> Name = sName
> END
to
> PUBLIC SUB _new(sName AS String)
> m_Name = sName
> END
----------
Add next to the end of your code
public sub Tag_Write(iTag as integer)
m_tag=iTag
end
public function Tag_Read() as integer
return m_Tag
end
public function Name_Read() as string
return m_Name
end
This must help you
See in the help browser for Property if you need more help.
Ron
More information about the User
mailing list