Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yull67
  
 
 
 Yull67
 To: Marcia Akins
  Where is Marcia Akins?
 Akorn
 Ohio - United States
 Marcia Akins
 Tags
Subject: RE: DODEFAULT/NODEFAULT
Thread ID: 154147 Message ID: 154666 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Tuesday, December 18, 2007 5:00:51 PM         
   


> I could not follow the rules of DODEFAULT & NODefault
>
> I mean VFP Help is not enought for me to follow.
>
> is there any clear concept with example!

>
> How VFP implements inheritance
>
> Visual FoxPro implements inheritance in a bottom upward fashion. When an event occurs which requires that an object takes some action, Visual FoxPro begins by executing any code that has been defined in the method associated with that event in the object (such code is, therefore, referred to as "Instance Level" and it will override any inherited code unless an explicit 'DODEFAULT()' function call is included at some point).
>
> If there is no code in the object (or a DoDefault() has been specified), VFP continues by executing any code defined in the same method in the class identified in the object's ParentClass property. This process continues up the hierarchy defined by successive ParentClass references until either a method containing code without an explicit DoDefault() or a class where the ParentClass property points directly to a Visual FoxPro base class, is found. Either condition identifies the 'Top' of the class hierarchy for that object and no further references are searched for.
>
> On completion of any instance level code, and any inherited code, Visual FoxPro finally runs any code that is defined in the relevant native base class method. (Any such code will always be executed unless you include an explicit NODEFAULT command somewhere in the inheritance chain.) Unfortunately there is no documentation to tell you which base class methods actually contain executable code, although some are obvious. KeyPress, GotFocus and LostFocus are all examples of events which require native behavior and which, therefore, have code in the baseclasses. Conversely there are events that obviously do not have any native behavior – Click, When and Valid are all examples of base class methods which simply return the default value (a logical .T.).
>
> The basic rule of thumb here is that the use of DoDefault() is a good thing. It means that behavior is being augmented in the sub-classes. Frequent over-riding of parent class behavior (i.e. method code in the sub-class that does not contain DoDefault()) is a sure sign that there are fundamental problems with the design of a class and generally means that functionality has been placed too high in the hierarchy.
>
>
> Regards,
> Marcia G. Akins
> Tightline Computers, Inc.


Very clean. Excellent candidate for a FAQ. My $0.02.

Yull

ENTIRE THREAD

DODEFAULT/NODEFAULT Posted by Binod Binani @ 12/12/2007 3:38:22 PM
RE: DODEFAULT/NODEFAULT Posted by Mike Gagnon @ 12/12/2007 4:09:04 PM
RE: DODEFAULT/NODEFAULT Posted by Cetin Basoz @ 12/12/2007 6:47:20 PM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/12/2007 8:12:23 PM
RE: DODEFAULT/NODEFAULT Posted by Hugo Ranea @ 12/12/2007 8:50:38 PM
RE: DODEFAULT/NODEFAULT Posted by Cetin Basoz @ 12/12/2007 11:07:17 PM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/12/2007 11:19:35 PM
RE: DODEFAULT/NODEFAULT Posted by Cetin Basoz @ 12/13/2007 12:08:16 AM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/13/2007 1:57:33 AM
RE: DODEFAULT/NODEFAULT Posted by Cetin Basoz @ 12/13/2007 12:53:25 PM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/12/2007 11:24:47 PM
RE: DODEFAULT/NODEFAULT Posted by Hugo Ranea @ 12/12/2007 11:43:42 PM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/13/2007 2:07:18 AM
RE: DODEFAULT/NODEFAULT Posted by Tamar Granor @ 12/13/2007 10:21:59 PM
RE: DODEFAULT/NODEFAULT Posted by Barbara Peisch @ 12/13/2007 11:39:00 PM
RE: DODEFAULT/NODEFAULT Posted by Bernard Bout @ 12/13/2007 6:48:48 AM
RE: DODEFAULT/NODEFAULT Posted by Ken Murphy @ 12/13/2007 12:59:51 PM
RE: DODEFAULT/NODEFAULT Posted by suhas hegde @ 12/13/2007 2:12:50 PM
RE: DODEFAULT/NODEFAULT Posted by Ken Murphy @ 12/13/2007 5:13:45 PM
RE: DODEFAULT/NODEFAULT Posted by suhas hegde @ 12/13/2007 6:15:11 PM
RE: DODEFAULT/NODEFAULT Posted by Bernard Bout @ 12/14/2007 3:16:38 PM
RE: DODEFAULT/NODEFAULT Posted by Ken Murphy @ 12/14/2007 3:18:39 PM
RE: DODEFAULT/NODEFAULT Posted by Marcia Akins @ 12/14/2007 12:59:28 PM
RE: DODEFAULT/NODEFAULT Posted by Yull67 @ 12/18/2007 5:00:51 PM
RE: DODEFAULT/NODEFAULT Posted by Marcia Akins @ 12/18/2007 11:12:56 PM