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

                              精通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指定。

                                
                         



                

  • 0
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论

打赏作者

daiping99

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值