Page 1 of 1

Naming "Feature" with Harbour Compiler?

PostPosted: Sun Nov 23, 2008 5:55 am
by xProgrammer
Hi all

It seems that if I use the same name for the source file of a class as the class itself ( for example CLASS myclass in file myclass.prg ) the harbour compiler gives an error, namely:

Error F0002 Redefinition of procedure or function: 'MYCLASS'
1 error

and the compilation ( to C source ) fails.

Is this correct / normal behaviour? Certainly xHarbour doesn't have any such problem.

Is this why so many classes are prefaced with a "T" ?

Thanks
xProgrammer

PostPosted: Sun Nov 23, 2008 9:19 am
by Antonio Linares
Doug,

This code is working fine here. Remember to use the flag /n :

myclass.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local o := MyClass():New()

   MsgInfo( o:ClassName() )

return nil

CLASS MyClass

   METHOD New() INLINE Self

ENDCLASS

> Is this why so many classes are prefaced with a "T" ?

Thats a tradition started from Borland code. They used "T" to distinct between a function name and a Class name. "T" was used for "Type".