|
|
类定义改为:
, `) D; F# S' c2 _1 n
+ Q; ^' e: K" {8 Z8 z% }$ Rclassdef myClass < handle
2 `# T2 K% z9 o0 a! s( I4 `) G$ e properties
2 |, l3 g. s: D, i9 S/ S x;- v4 Z9 j0 Z: y( a2 n. i# w& _+ N3 ^
y;4 q, a& H/ m" u. i+ ~
s;2 ^' n% v$ U' i" o
end
' \* G0 x+ i/ D) H methods
4 G" @. A6 c+ p. [* |# ?! @9 n* A2 @ function obj=myClass(a,b); `2 n& V4 Y# V
obj.x=a;
3 G' b2 q5 x/ Z2 G& X9 Y obj.y=b;( Z7 D: R2 {2 J: j5 a* q# x$ w
end
; K) `! P9 H) n* q- L. r function myAdd(obj). k. w. {# E5 a8 l9 t
obj.s=obj.x+obj.y
+ O6 z7 |/ w$ W5 m end- U& H: s2 q/ R5 x( m+ [
end8 P& _% [6 |- W; P( R
end |
|