类 读书笔记

Posted on 2005-06-02 21:52  岳洋  阅读(449)  评论(0)    收藏  举报

继承
public class Male
    
inherits Human
end class

男人和女人的区别在哪里呢?就是男人不能生小孩。所以我们可以在Male类中把Human里的Born函数重写一下,使其更适合Male。不过在这之前,我们要把Human中的Born函数加上一个修饰符overridable(可重写的):
public overridable function Born() as Human
    
if Gender = "" then
        
return new Human("","",50)
    
else
        
return nothing
    
end if
end function

重载
Public Overloads Function FindData(ByVal Name As StringAs ArrayList 
REM (搜索数据并且返回结果)
End Function


Public Overloads Function FindData(ByVal Age As IntegerAs ArrayList
REM (搜索数据并且返回结果)
End Function
 

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3