zoukankan      html  css  js  c++  java
  • 1 virtual

    1 differents:

    'virtual' just in C#  

    In Java It does't have the keyword

    2 Usages in C#

             used in base class,two situations as following :

            • If you define one function by 'virtual' in base class,and you don't override this function in derived classes. when it invoked, the function in base class will be call back.

            • If you define one function by 'virtual' in base class,and you do override this function in derived classes. when it invoked, the function in derived class will be call back.

    What is virtual function?

    This means that it does not  really exist in the Memory until the object will have  been instantiated.

    3 Usages in Java

              firstly, there is no keyword of 'virtual'

              In Polymorphism, when the object reference of superclass appoint to the object of superclass, if you want to invoke the functions in subclasses,you must add the '@override' above the fucntions you overrided in the subclasses.

              For you reference, pls see the article named 'Factory Method'.

    Aimer,c'est partager
  • 相关阅读:
    jquery 插件扩展2
    jquery 插件扩展
    call apply bind
    bom object
    js oop 封装
    js oop 继承
    js页面之间传参2
    js弹出新窗口的6中方法
    display Tag
    js中extends方法
  • 原文地址:https://www.cnblogs.com/pickKnow/p/8446906.html
Copyright © 2011-2022 走看看