Index
1999-09-14 09:22AMS Computing, computing@dial.pipex.com: VFP6 & OOP - newbie question
1999-09-14 09:44Michael Babcock, mbabcock@kepro.org: VFP6 & OOP - newbie question -Reply
1999-09-14 09:46Mary Hintermeier, mhinterm@RSA-NET.COM: Re: VFP6 & OOP - newbie question
1999-09-14 09:52Bourque, Chad, Chad@teche.net: Re: VFP6 & OOP - newbie question
1999-09-14 09:56Andy_Davies/ITUnit/MCC@notes.manchester.gov.uk: Re: VFP6 & OOP - newbie question -Reply
1999-09-14 10:45Anders Altberg, anders.altberg@swipnet.se: Re: VFP6 & OOP - newbie question
1999-09-14 10:51Anders Altberg, anders.altberg@swipnet.se: Re: VFP6 & OOP - newbie question
1999-09-14 12:55Cotton Jerry P, CottonJP@2mawcp.usmc.mil: RE: VFP6 & OOP - newbie question
1999-09-14 12:59Gene Wirchenko, genew@shuswap.net: RE: VFP6 & OOP - newbie question
1999-09-14 13:44Cotton Jerry P, CottonJP@2mawcp.usmc.mil: RE: VFP6 & OOP - newbie question
Back to top
VFP6 & OOP - newbie question

Author: AMS Computing, computing@dial.pipex.com

Posted: 1999-09-14 09:22:58   Link

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 AMS Computing, computing@dial.pipex.com
Back to top
VFP6 & OOP - newbie question -Reply

Author: Michael Babcock, mbabcock@kepro.org

Posted: 1999-09-14 09:44:14   Link

Makes sense to me, because without the dodefault(), your child proc (Show) is

overriding the inherited code.

HTH,

--Mike

>>> "computing@dial.pipex.com" 09/14/99 09:37am >>>

####################################################

The following message part was sent with the unknown

character set: "WINDOWS-1252"

####################################################

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

********************************

Michael Babcock

KePRO, Inc.

Tel: 717-564-8288

Fax: 717-564-4188

Internet Address: mbabcock@kepro.org

Home Page: http://www.kepro.org

********************************

©1999 Michael Babcock, mbabcock@kepro.org
Back to top
Re: VFP6 & OOP - newbie question

Author: Mary Hintermeier, mhinterm@RSA-NET.COM

Posted: 1999-09-14 09:46:44   Link

You got it exactly right Stuart.

The beauty of subclassing and VFP is that you can completely override the

behavior of a method in a subclass and the class interface doesn't change.

A better design may have been to have an AbstractPoly class which has just an

Empty Show method() and then subclass into PolyWaitWindow and PolyPrint

AbstractPoly Show method does nothing

PolyWaitWindow Show method shows stuff via WAIT WINDOW

PolyPrint Show method show stuff via ?

Although the implementation of the Show method in each subclass is different,

the interface into the object remains the same in all classes. So if I want to

write a program which initially does wait windows I can do

At design time or in a separate program/class I can do

this.cPolyClassToInstatiate = 'PolyWaitWindow'

In a standard program used regardless of the actual implementation of the Show()

method

loPoly = CREATE(this.cPolyClassToInstatiate)

loPoly.Show()

And then later, if I change my mind, I just have to change the calling

program/class to do

this.cPolyClassToInstatiate = 'PolyPrint'

"AMS Computing" <computing@dial.pipex.com> on 09/14/99 09:22:58 AM

Please respond to profox@leafe.com

To: Multiple recipients of ProFox <profox@leafe.com>

cc: (bcc: Mary Hintermeier/RSA)

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 Mary Hintermeier, mhinterm@RSA-NET.COM
Back to top
Re: VFP6 & OOP - newbie question

Author: Bourque, Chad, Chad@teche.net

Posted: 1999-09-14 09:52:33   Link

Stuart,

This is correct. You are overriding xPoly.Show() with xPolyChild.Show(),

not appending to it. The DoDefault() makes an explicit call to the Parent

method of the same name. This gives you the ability to add code before

and/or after the parent code or, as you have demonstrated, override the

parent code. Sample of before and after:

Proc Show

Wait Window 'This is Child Before Parent'

DoDefault()

Wait Window 'This is Child After Parent'

EndProc

HTH

Chad Bourque

U.S. Bankruptcy Court - 11th Circuit

Alabama - Northern District - Southern Division

Chad@teche.net

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

From: AMS Computing <computing@dial.pipex.com>

To: Multiple recipients of ProFox <profox@leafe.com>

Sent: Tuesday, September 14, 1999 8:22 AM

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 Bourque, Chad, Chad@teche.net
Back to top
Re: VFP6 & OOP - newbie question -Reply

Author: Andy_Davies/ITUnit/MCC@notes.manchester.gov.uk

Posted: 1999-09-14 09:56:50   Link

"Is this correct, it does make sense?"

Seems OK to me too, but I'm not very OOPy.

BTW if you do DODEFAULT() you then get :

1) a ? message

2) a wait window

both generated by your SHOW() - thus exhibiting a simple polymorphism in

the SHOW method.

©1999 Andy_Davies/ITUnit/MCC@notes.manchester.gov.uk
Back to top
Re: VFP6 & OOP - newbie question

Author: Anders Altberg, anders.altberg@swipnet.se

Posted: 1999-09-14 10:45:21   Link

That's how VFP works. Userdefined code is always overridden unless the

superclass code is called with :: or dodefault(). Baseclass behavior is

never overridden unless stopped with NODEFAULT. Other OOP implementations

work the other way around. There's no one right way.

-Anders

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

From: AMS Computing <computing@dial.pipex.com>

To: Multiple recipients of ProFox <profox@leafe.com>

Sent: tisdag den 14 september 1999 15:22

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 Anders Altberg, anders.altberg@swipnet.se
Back to top
Re: VFP6 & OOP - newbie question

Author: Anders Altberg, anders.altberg@swipnet.se

Posted: 1999-09-14 10:51:45   Link

Jerry

Nodefault doesn't prevent the parentclass from running, it prevents the

baseclass behavior from doing its stuff.

-Anders

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

From: Cotton Jerry P <CottonJP@2mawcp.usmc.mil>

To: Multiple recipients of ProFox <profox@leafe.com>

Sent: tisdag den 14 september 1999 18:55

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.

|

| 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 Anders Altberg, anders.altberg@swipnet.se
Back to top
RE: VFP6 & OOP - newbie question

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

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

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
Back to top
RE: VFP6 & OOP - newbie question

Author: Gene Wirchenko, genew@shuswap.net

Posted: 1999-09-14 12:59:28   Link

>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 Gene Wirchenko, genew@shuswap.net
Back to top
RE: VFP6 & OOP - newbie question

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

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

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