OVERRIDE METHOD

95 views
Skip to first unread message

Leonardo

unread,
Feb 11, 2012, 12:45:11 PM2/11/12
to Harbour Developers
Hi,

How do I use OVERRIDE METHOD contains the same xHarbour ?

OVERRIDE METHOD
Replaces a method in an existing class.

example of the help of xHarbour:

#include "hbclass.ch"

PROCEDURE Main()
LOCAL cVar := "Hello", GetList := {}

CLS

OVERRIDE METHOD Display IN CLASS GET WITH MyGetDisplay
OVERRIDE METHOD AsString IN CLASS ARRAY WITH MyArrayString

@ 10,10 GET cVar

? GetList:AsString()
RETURN

STATIC FUNCTION MyGetDisplay
LOCAl Self := HB_QSelf()
Alert( ::VarGet() )
RETURN Self

STATIC FUNCTION MyArrayString()
LOCAl Self := HB_QSelf()
RETURN "{ ... }"

Rossine

unread,
Feb 12, 2012, 7:44:27 AM2/12/12
to Harbour Developers
Hello Leonardo,

Inside this:

#include "xhbcls.ch"

and Code:

[CODE]
#include "xhbcls.ch"

PROCEDURE Main()
LOCAL cVar := "Hello", GetList := {}

CLS

OVERRIDE METHOD Display IN CLASS GET WITH MyGetDisplay
OVERRIDE METHOD AsString IN CLASS ARRAY WITH MyArrayString

@ 10,10 GET cVar

? GetList:AsString()
RETURN

STATIC FUNCTION MyGetDisplay
LOCAl Self := HB_QSelf()
Alert( ::VarGet() )
RETURN Self

STATIC FUNCTION MyArrayString()
LOCAl Self := HB_QSelf()
RETURN "{ ... }"

[END_CODE]

Best Regards,

Rossine.

Leonardo Machado

unread,
Feb 12, 2012, 9:05:37 AM2/12/12
to Harbour Users
Thanks

Leonardo Machado


> Date: Sun, 12 Feb 2012 04:44:27 -0800
> Subject: [harbour] Re: OVERRIDE METHOD
> From: qii...@ig.com.br
> To: harbou...@googlegroups.com

Klas Engwall

unread,
Feb 12, 2012, 9:30:49 AM2/12/12
to harbou...@googlegroups.com
Hi Leonardo,

Please ask support questions in the harbour-users group. Harbour-devel
is for reporting bugs in Harbour and for discussing improvements and new
features in the language.

Regards,
Klas

> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1913 / Virus Database: 2112/4803 - Release Date: 02/11/12
>
>
>

Reply all
Reply to author
Forward
0 new messages