about class

Moderator: Rathinagiri

Post Reply
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

about class

Post 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
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: about class

Post by srvet_claudio »

See:

Code: Select all

 ::super:New()
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: about class

Post by huiyi_ch »

HI Dr. Claudio
Thank you very much!
Post Reply