RE: VFP6 & OOP - newbie question

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

Posted: 1999-09-14 at 12:55:41

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.

The following shows both statements.

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

ENDDEFINE

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: AMS Computing [mailto:computing@dial.pipex.com]

Sent: Tuesday, September 14, 1999 9:23 AM

To: Multiple recipients of ProFox

Subject: VFP6 & OOP - newbie question

Okay so I am thick, but does the Polymorphism donkey upset Inheritance cart?

Using an example from a book to explain Poly...

*****

DEFINE CLASS xPoly AS custom

PROC show

WAIT WINDOW 'This is the root class'

ENDPROC

ENDDEFINE

DEFINE CLASS xPolyChild AS xPoly

PROC show

? 'This is the child of xPoly'

ENDPROC

ENDDEFINE

SET PROC TO ...

oTest = CREATEOBJECT('xPolyChild')

oTest.Show()

****

Only shows the child not the parent, unless I included DODEFAULT() in

xPolyChild.Show

Is this correct, it does make sense?

regards

Stuart Hurley

ams_ltd@dial.pipex.com

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