html5中文学习网

您的位置: 首页 > 网络编程 > ASP编程 » 正文

ASP 类组合_ASP教程_编程技术

[ ] 已经帮助:人解决问题

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

6FjHTML5中文学习网 - HTML5先行者学习网
6FjHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助