[Gambas-user] INHERITS

Fabien Bodard abidoo.too at ...11...
Tue Apr 13 21:12:54 CEST 2004


Le mardi 13 Avril 2004 17:56, ron a écrit :
> 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


> > ' Gambas class file
> > INHERITS {Timer}
> >
PUBLIC tag AS Integer    '----> You must to set this variable public ! Thats 
all ;-)
> >
> > PUBLIC Name AS String
> >
> > PUBLIC SUB _new(sName AS String)
> >  Name = sName
> > END




More information about the User mailing list