Page 1 of 1

about class

Posted: Thu Oct 27, 2016 8:31 am
by huiyi_ch
Hi All
为什么这个程序会出现“Variable does not exist:SUPER"的错误信息呢?
使用HMG3.4.3编译.
Why does this program will appear "Variable does not exist: SUPER" error message?
Compile with HMG3.4.3.

Code: Select all

REQUEST HB_GT_WIN_DEFAULT
function Main()
   local o 
   local p
   setmode(25,80)
   cls
   o:= TTest():New( "one", "two" )
   ? o:ClassName()
   ? o:One
   ? o:Two
   o:Test()
return nil


#include "hbclass.ch"
CLASS TParent
   DATA One
   METHOD New()
ENDCLASS

//--------------------------------------------------------------------//
METHOD New() CLASS TParent
 ? "TParent"
return Self
//-------

CLASS TTest INHERIT TParent
   DATA One, Two, Three
   METHOD New( One, Two )
   METHOD Test() INLINE QOut( "Hello" )
ENDCLASS
//--------------------------------------------------------------------//
METHOD New( One, Two ) CLASS TTest
   super:New()
   ::One := One
   ::Two := Two
return Self

Re: about class

Posted: Thu Oct 27, 2016 1:23 pm
by srvet_claudio
See:

Code: Select all

 ::super:New()

Re: about class

Posted: Fri Oct 28, 2016 12:33 am
by huiyi_ch
HI Dr. Claudio
Thank you very much!