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
  • 相关阅读:
    算法
    爬虫--scrapy框架
    Flask--SQLAlchemy
    Flask--WTForms
    Django--model操作
    Odoo10 自定义模块创建
    odoo10 工作流、安全机制、向导
    odoo10 高级视图
    odoo10 onchange、唯一性约束
    Odoo10 模型(结构化的应用数据)、视图(用户界面设计)
  • 原文地址:https://www.cnblogs.com/pickKnow/p/8446906.html
Copyright © 2011-2022 走看看