20000305-08:38 GMT-8 Brian Hays <bhays@abacuslaw.com>

This commit is contained in:
Brian Hays
2000-03-06 04:52:45 +00:00
parent eafad66714
commit 11782e60a3
3 changed files with 124 additions and 25 deletions

View File

@@ -1,3 +1,7 @@
20000305-08:38 GMT-8 Brian Hays <bhays@abacuslaw.com>
* tests/testop.prg
* doc/en/command.txt
+ added Operator Overloading test and reference to it in METHOD Command
20000306-04:43 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/rtl/cmdcheck.c
! -gc0 switch got removed. Added again.
@@ -5,7 +9,7 @@
makefile.bc
makefile.vc
% -gc0 switch added to speed up make process.
The size of the obj/b32 dir after a make was 8.9MB before,
The size of the obj/b32 dir after a make was 8.9MB before,
and 7.7MB after.
* source/vm/debug.c
doc/en/hvm.txt
@@ -103,7 +107,7 @@
makefile.vc
! Fixed OBJ32 support.
(Note that for some unknown reason the linker GPF on Harbour executables
when the OBJ generation is turned on, and the .OBJ format is also
when the OBJ generation is turned on, and the .OBJ format is also
rejected by the linker. Tested with BCC53 and BCC55)
* source/compiler/genobj32.c
+ Stub added for non OBJ32 support mode.
@@ -171,26 +175,26 @@
most common header file EXTEND.H is only a CA-Cl*pper compatibility
file, in for new Harbour code you should use HBAPI.H instead.
errorapi.h -> hbapierr.h
filesys.h -> hbapifs.h
gtapi.h -> hbapigt.h
itemapi.h -> hbapiitm.h
langapi.h -> hbapilng.h
mouseapi.h -> hbapimou.h
rddapi.h -> hbapirdd.h
box.h -> hbbox.h
compiler.h -> hbcomp.h
setcurs.h -> hbcursor.h
dates.h -> hbdate.h
expropt.h -> hbexprop.h
init.h -> hbinit.h
inkey.h -> hbinkey.h
macro.h -> hbmacro.h
pcode.h -> hbpcode.h
set.h -> hbset.h
ctoharb.h -> hbvm.h
hb_vmpub.h -> hbvmpub.h
extend.h -> hbapi.h
errorapi.h -> hbapierr.h
filesys.h -> hbapifs.h
gtapi.h -> hbapigt.h
itemapi.h -> hbapiitm.h
langapi.h -> hbapilng.h
mouseapi.h -> hbapimou.h
rddapi.h -> hbapirdd.h
box.h -> hbbox.h
compiler.h -> hbcomp.h
setcurs.h -> hbcursor.h
dates.h -> hbdate.h
expropt.h -> hbexprop.h
init.h -> hbinit.h
inkey.h -> hbinkey.h
macro.h -> hbmacro.h
pcode.h -> hbpcode.h
set.h -> hbset.h
ctoharb.h -> hbvm.h
hb_vmpub.h -> hbvmpub.h
extend.h -> hbapi.h
hbfsapi.h -> hbapifs.h (merged into)
20000302-12:35 GMT+1 Ryszard Glab <rglab@imid.med.pl>
@@ -202,7 +206,7 @@
*source/rtl/typefile.prg
*removed RETURN NIL in a PROCEDURE
20000301-15:20 EST Paul Tucker <ptucker@sympatico.ca>
* source/tools/strasint.c
* remove extraneous characters at end.

View File

@@ -235,7 +235,7 @@
* when you are first creating and testing a Class.
*
* OPERATOR Operator Overloading for classes.
* See example TestOp.prg for details.
* See example Tests/TestOp.prg for details.
*
* CLASS <ClassName>
* Use this syntax only for defining a full method after
@@ -257,6 +257,8 @@
* ... <code> ...
* ... <code> ...
* RETURN Self
* $TESTS$
* TestOp.prg
* $STATUS$
* R
* $COMPLIANCE$
@@ -264,7 +266,7 @@
* $PLATFORMS$
* All
* $SEEALSO$
* TClass(),Object Oriented Programming,DATA,CLASS,TestOp.prg
* TClass(),Object Oriented Programming,DATA,CLASS
* $END$
*/

93
harbour/tests/testop.prg Normal file
View File

@@ -0,0 +1,93 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Testing the operators-overloading feature
*
* Copyright 2000 Antonio Linares <alinares@fivetech.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) with other files to produce
* an executable, this does not by itself cause the resulting executable
* to be covered by the GNU General Public License. Your use of that
* executable is in no way restricted on account of linking the HRL
* and/or HVM code into it.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "hbclass.ch"
// Right now you can overload operators with Harbour
// as C++ does!!! Not all operators are available. ASAP we will provide all
// of them.
//----------------------------------------------------------------------------//
function Main()
local oCar := TCar():New( "red", 2 )
local oPetrol
oCar = oCar + oPetrol
return nil
//----------------------------------------------------------------------------//
CLASS TCar
DATA cColor
DATA nDoors
DATA oGas
METHOD New( cColor, nDoors ) CONSTRUCTOR
METHOD Sum( oObject ) OPERATOR '+'
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( cColor, nDoors ) CLASS TCar
if cColor == nil
cColor = "White"
endif
if nDoors == nil
nDoors = 4
endif
::cColor = cColor
::nDoors = nDoors
return Self
//----------------------------------------------------------------------------//
METHOD Sum( oObject ) CLASS TCar
Alert( "+ has a special meaning and " + ;
"functionality for TCar Class objects!!!" )
return nil
//----------------------------------------------------------------------------//