日期:2009-12-15 浏览次数:20852 次
ASP 类的功能实在有限,所以有时我们要实现复杂的功能,只好用组合来实现。
class CFish
sub Swim()
end sub
end class
class CBird
sub Fly()
end sub
end class
class CAnimal
dim fish
dim bird
private sub class_initialize()
set fish = new CFish
set bird = new CBird
end sub
private sub class_terminate()
set fish = nothing
set bird = nothing
end sub
end class
dim animal
set animal = new CAnimal
call animal.fish.Swim() '鱼游
call animal.bird.Fly() '鸟飞
set animal = nothing