[Gambas-user] INHERITS
ron
ronstk at ...239...
Tue Apr 13 20:41:16 CEST 2004
On Tuesday 13 April 2004 13:20, Dimitri Bellini wrote:
> Thanks Ron for your help... but i'm a donkey :-)
> i have write this class XTimer.class
> ----
> Gambas class file
> INHERITS {Timer}
>
> PRIVATE iTag AS Integer <-------- i never have say this
> PRIVATE m_tag AS Integer
> PRIVATE m_Name AS String
>
> PUBLIC Name AS String <-------- i say change to
see the code again below
>
> PUBLIC SUB _new(sName AS String)
> Name = sName
> END
>
> 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
> ------
> and i call it as i write in last mail from Start Class:
> ------
> tmr=NEW XTimer("XTimer", FMain) AS "tmrCab"
> tmr.tag=i
> ------
> But i cant understand how it work and gambas return the same error... :-(
> Im boring you with my stupid question i know... but can you give me some
> explaination.
> Thanks in advance
> Dimitri
>
> On Tuesday 13 April 2004 15:56, ron wrote:
> > 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
cambi il codice seguente dal
> > --------
> >
> > > PRIVATE tag AS Integer
> >
> > to
a
> > property tag as integer 'need read and write
------------------------
Colto esso buono:
property tag as integer
Avete scritto:
private iTag as integer
> > 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
> >
Try again and you will learn :=)
La prova ancora e voi impareranno: =)
The Flying Dutch Man,
Ron
More information about the User
mailing list