精通ASP.NET(基于VB.NET)(四)VB.NET继承

来源:互联网 发布:淘宝店铺出租安全吗 编辑:程序博客网 时间:2024/04/29 22:22
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

                              NET/Develop/read_article.ASP?id=18140" target=_blank>精通ASP.NET基于VB.NET)(四)VB.NET继承
                 (1) 理解继承继承是实现相关类方法、接口等共享的一种手段。相关类是指类及其派生类。基于不同类实例的独特性,故引入了public、private、protected作用域和overrides(重写)、方法重载overloads。这样作的目的:提高代码的复用性。
                 (2)继承的种类:实现继承、接口继承和可视继承
                 (3)接口:先看一例
                            Interface Inter_comm
                                      sub read_x(by vlue x as integer)
                                      Function write_x(by vlue x as integer) as long
                                      Property pr_x() as string
                             end interface
                             class Inter_comm_made
                                      Implements Inter_comm
                                       private x as string
                                       sub read_x(by vlue x as integer) Implements Inter_comm.read_x
                                       end sub
                                      Function write_x(byval x as integer) as long Implements Inter_comm.write_x
                                      end function
                                       Property pro_x() as string Implements Inter_comm.pr_x
                                       get
                                              return x
                                       end get
                                        set(byval value as string)
                                                 x=value
                                        end set
                                        end class
                        接口定义用Interface。实现用类或结构,用Implements指定。
                                
                         


                

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击