Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........
Started by Allan, November 16, 2008, 06:39:34 PM
0 Members and 1 Guest are viewing this topic.
QuoteCompiling...Main.ebaFile: C:\My EBasic Forum\DTP\Main.eba (35) Warning: Uninitialized variable: DemoDTP - CDTPCDTP.eba
SUB CDTP::SetWindow(window win) win = winENDSUB
SUB CDTP::SetWindow(window win) *<CDTP>this.win = winENDSUB
CLASS CDTP DECLARE CDTP() DECLARE SetWindow(window win) DECLARE DrawObject()PROTECTED WINRECT m_DRect POINTER m_winENDCLASS
' CDTP.eba$INCLUDE "CDTP.inc"SUB CDTP::CDTP() m_DRect.left = 10 m_DRect.top = 10 m_DRect.right = 180 m_DRect.bottom = 120 m_win = NULLENDSUBSUB CDTP::SetWindow(window win) m_win = winENDSUBSUB CDTP::DrawObject() IF m_win RECT #<WINDOW>m_win, m_DRect.left, m_DRect.top, m_DRect.right, m_DRect.bottom, RGB(255,155,0), RGB(100,0,255) ENDIFENDSUB
SUB MakeDemo(),INT DEF DemoDTP as CDTP DemoDTP.SetWindow(Main) DemoDTP.DrawObject() RETURN 0ENDSUB
Quotecan you put another Class into a Class as a Member of the class.
QuoteHave you read the users guide section?
QuoteAccess protectionIt is generally considered bad form to directly access a member variable from outside of a method implementation. In the above examples we have been setting the name of the employee directly using a dot operator.To aid in limiting outside access to an objects data Emergence provides three keywords, PUBLIC, PRIVATE and PROTECTED that control how an objects methods and members may be used.
SUB CreateInterfacepointer obj obj = NEW(GWindow,1) #<GWindow>obj.Create(100,100,100,100) ListAdd(gList,obj) obj = NEW(GButton,1) #<GButton>obj.Create(10,10,50,20,"Close") ListAdd(gList,obj) obj = NEW(GMenu,1) #<GMenu>obj.AddTitle("File") #<GMenu>obj.AddItem("Quit") ListAdd(gList,obj)ENDSUBSUB DrawEverything(pointer list)pointer obj for obj = each list as GWindow #obj.Draw() nextENDSUB
QuoteOf course I have suggestions.....
SUB DrawEverything(pointer list) pointer obj for obj = EACH list AS CDTPObject #obj.Draw() NEXTENDSUB
class SomeClassdeclare virtual Draw()declare virtual Erase()end Classsub SomeClass::Draw()endsubsub SomeClass::Erase()endsubdef class1 as SomeClass
SomeClass_vtable_ dd $SomeClass@Draw dd $SomeClass@Erasesegment .bss use32 align=4$class1 resb 4
class AnotherClass,SomeClassdeclare virtual Draw()end Classsub AnotherClass::Draw()endsubdef class2 as AnotherClass
SomeClass_vtable_ dd $SomeClass@Draw dd $SomeClass@EraseAnotherClass_vtable_ dd $AnotherClass@Draw dd $SomeClass@Erase
QuoteIs it purely an internal windows thing that I should accept that that's the way it works 'just cause'
m_LineWidth = 1 m_LineStyle = "@LSSOLID"
m_LineWidth = #obj.LineWidth m_LineStyle = #obj.LineStyle
WRITE #gf, m_LineWidth WRITE #gf, m_LineStyle
READ(#gf, m_LineWidth) READ(#gf, m_LineStyle)