RE: VFP6 & OOP - newbie question

Author: Cotton Jerry P, CottonJP@2mawcp.usmc.mil

Posted: 1999-09-14 at 13:44:03

OK! I'm getting an education. What's even more interesting is that if you

simply just have the method identified(with no code in the procedure) the

parent code does not run.

oTest = CREATEOBJECT('xPolyChild')

oTest.Show()

DEFINE CLASS xPoly AS custom

PROC show

WAIT WINDOW 'This is the root class'

ENDPROC

ENDDEFINE

DEFINE CLASS xPolyChild AS xPoly

PROC init

? 'This is the child of xPoly'

ENDPROC

proc show

endproc

ENDDEFINE

I thought I understood this stuff till we started talking about it.

Mr. Jerry Cotton MCP

2nd Marine Aircraft Wing Comptroller's Office

MCAS Cherry Point NC

mailto:cottonjp@2mawcp.usmc.mil

(252)466-2320 fax (252)466-4806 DSN-582

-----Original Message-----

From: genew@shuswap.net [mailto:genew@shuswap.net]

Sent: Tuesday, September 14, 1999 12:59 PM

To: Multiple recipients of ProFox

Subject: RE: VFP6 & OOP - newbie question

>As I understand inheritance (if I'm confused somebody straighten me out)

>

>When you put code in the child property you are overriding the code that is

>in the parent class, thus the behavior that you note. DODEFAULT()

>explicitly calls the code of the parent class just as NODEFAULT explicitly

>prevents the parent code from running.

Uh, not quite on the nodefault. If there is one, then the parent class

code is already being overridden because you have code in the child method

(if only the nodefault). The nodefault prevents the baseclass method

"associated action" (I can't think of a better term.) from being done.

For example, keypress has a base class associated action of adding the

keystroke to the control's input. nodefault says to not do that, so the

character gets thrown away.

I think (I haven't tried it, but see no reason why it wouldn't work.)

that you could have both dodefault() and nodefault executed in the same run

of a method and it would work.

With the above example, the parent might have a list of throwaway

characters and the child might call it and have its own add-on list. At the

end of the child, there could be a test if the character is to be tossed and

if so, a nodefault.

[snip]

Sincerely,

Gene Wirchenko

genew@shuswap.net

Computerese Irregular Verb Conjugation:

I have preferences.

You have biases.

He/She has prejudices.

©1999 Cotton Jerry P, CottonJP@2mawcp.usmc.mil