Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Classes
#6
A class can optionally have constructor, destructor and operator=. To add them, use item names like in the examples.

Constructor
Member function CRect
Code:
Copy      Help
out "This function is called when the variable is created."

m_width=1
m_height=1

Destructor
Member function CRect.
Code:
Copy      Help
out "This function is called before destroying the variable."

Operator =
Member function CRect=
Code:
Copy      Help
function CRect&source

out "This function is called when you assigh one variable to another variable, both of CRect type."

this.m_width=source.m_width
this.m_height=source.m_height


Test:
Macro
Code:
Copy      Help
CRect r1 r2
r1.Init(5 5)
out r1.Area
out r2.Area
r2=r1
out r1.Area
out r2.Area


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)