[Gambas-user] INHERITS
Dimitri Bellini
dimitribellini at ...69...
Tue Apr 13 13:20:53 CEST 2004
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
PRIVATE m_tag AS Integer
PRIVATE m_Name AS String
PUBLIC Name AS String
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
> --------
>
> > 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
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list