FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour super... objetos
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
super... objetos
Posted: Mon Mar 29, 2021 03:52 AM
Hola

Code (fw): Select all Collapse
class t1
   method guardar()
end class

class t2 from t1
   method guardar()
   method pantalla()
end class

method pantalla() class T2
  ::guardar()
return (nil)

method guardar() class T2
    SUPER:guardar() <-------------------- aca necesito sber como llamar al metodo guardar de la clase T1 y despues seguir con las instrucciones 
    ...
    ...
    return (nil)

cmo lo hago?
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: super... objetos
Posted: Mon Mar 29, 2021 08:29 AM
Prueba este código

Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

  Local oT2 := T2():New()

  oT2:Guardar()
  oT2:Super:Guardar()

Return ( nil )  

CLASS T1

  METHOD Guardar()

END CLASS

METHOD Guardar() CLASS T1

  ? "Guardar T1"

Return ( nil )  

CLASS T2 FROM T1

  METHOD Guardar()

END CLASS

METHOD Guardar() CLASS T2

  ? "Guardar T2"

Return ( nil )
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: super... objetos
Posted: Mon Mar 29, 2021 09:29 AM

pasa que desde la clase T2 necesito llamar a la claase super guardar()

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: super... objetos
Posted: Mon Mar 29, 2021 09:41 AM
Ok, entonces ...

Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

  Local oT2 := T2():New()

  oT2:Guardar()

Return ( nil )  

CLASS T1

  METHOD Guardar()

END CLASS

METHOD Guardar() CLASS T1

  ? "Guardar T1"

Return ( nil )  

CLASS T2 FROM T1

  METHOD Guardar()

END CLASS

METHOD Guardar() CLASS T2

  ::Super:Guardar()

Return ( nil )
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: super... objetos
Posted: Mon Mar 29, 2021 10:23 AM

Ganial. Gracias.
Me faltaban los :: delante del súper

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/

Continue the discussion