FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Solucionado problema con herencia en clases...
Posts: 38
Joined: Mon Nov 28, 2005 02:10 PM
Solucionado problema con herencia en clases...
Posted: Tue Nov 29, 2005 01:07 AM
Hola a todos, gracias a la ayuda de Oskar y Fernando "Fgondi", logre solucionar mi problema al querer heredar DATAS en las clases que estoy construyendo, era solo de declara "CLASSDATA" las variables que quieron sean heredades con sus valores alterados en la clase principal.
Este es un ejemplo.

#Include "FiveWin.ch"

//--------------------------------
FUNCTION Main()
Local oApp, oSeg
  oApp := TPrincipal():New()

  oApp:Ingreso()
  ? oApp:lIngreso     //--------> el resultado es .T.

  oSeg := TSegunda():New()
  ? oSeg:lIngreso //--------> el resultado es .T.  "como quería"


RETURN NIL


//--------------------------------
CLASS TPrincipal

   DATA cVersion
   CLASSDATA lIngreso
 
   METHOD New CONSTRUCTOR   
   METHOD Ingreso

ENDCLASS

//--------------------------------
METHOD New() CLASS TPrincipal

   ::lIngreso := .F.
   ::cVersion := "Versión 1.0.1"

RETURN Self

//--------------------------------
METHOD Ingreso() CLASS TPrincipal

   ::lIngreso := .T.

RETURN NIL


#Include "FiveWin.ch"
//--------------------------------
CLASS TSegunda FROM TPrincipal 

   METHOD New() CONSTRUCTOR

ENDCLASS

//--------------------------------
METHOD New() CLASS TSegunda

RETURN Self


Saludos,

Carlos Sincuir

Continue the discussion