Subject |
Re: INHERITANCE |
From |
Mustansir Ghor <mustan31@hotmail.com> |
Date |
Thu, 20 Jul 2017 02:53:16 -0400 |
Newsgroups |
dbase.getting-started |
Dear Andy
Thanks. I understand super class. But somehow in my case it failed to work. i cant figure out why.
Best Regards
Mustansir
Andy Taylor Wrote:
> Mustansir,
>
> I have added a custom form to ccSupermethods which is now derived from MyForm so that
> you can see that super:: contained within a method of the form applies to the form's "parent" class....
>
> Andy
>
> // Save the following as ccSuperMethods.wfm
> *--cut here----------------------------------------------*
> // displays use of methods in cc & calling with super...
> set procedure to ccSuperMethods.wfm additive
> ** END HEADER -- do not remove this line
> //
> // Generated on 18/09/2016
> //
> parameter bModal
> local f
> f = new InheritForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class InheritForm of MyForm from ccSupermethods.wfm
> with (this)
> height = 10.1364
> left = 88.7143
> top = 9.1364
> width = 46.7143
> text = "CcSuperMethods"
> endwith
>
> this.TXT1 = new MyTXT1(this)
> with (this.TXT1)
> height = 1.0
> left = 4.0
> top = 1.5
> width = 12.0
> text = "Txt1"
> endwith
>
> this.TXT2 = new MyTXT2(this)
> with (this.TXT2)
> height = 1.0
> left = 4.0
> top = 3.5
> width = 12.0
> text = "Txt2"
> endwith
>
> this.TXT3 = new MyTxt3(this)
> with (this.TXT3)
> height = 1.0
> left = 4.0
> top = 5.5
> width = 12.0
> text = "Txt3"
> endwith
>
> function onopen
> this.name = this.text
> super::onOpen()
>
> endclass
>
> Class MyTxt1(f) of Text(f) custom
> Function OnOpen
> Msgbox("I am "+this.name+" running "+Program())
> Endclass
>
> Class MyTxt2(f) of MyTxt1(f) custom
> Function OnOpen
> super::OnOpen()
> *--now my own
> Msgbox("I am "+this.name+" running "+Program())
> Endclass
>
> Class MyTxt3(f) of MyTxt2(f) custom
> Function OnOpen
> MyTxt2::OnOpen()
> *--now my own
> Msgbox("I am "+this.name+" running "+Program())
> Endclass
>
> class MyForm of FORM
> with (this)
> height = 16.0
> left = 96.5714
> top = 12.1364
> width = 40.0
> text = ""
> endwith
>
> function onOpen
> Msgbox("I am "+this.name+" running "+Program())
>
> endclass
>
> *---end here--------*
|
|