zoukankan      html  css  js  c++  java
  • abstractmethod

    a class with an abstract method cannot be instantiated (that is, we cannot create an instance by calling it) unless all of its abstract methods have been defined in subclasses. Although this requires more code and extra knowledge, the potential advantage of this approach is that errors for missing methods are issued when we attempt to make an instance of the class, not later when we try to call a missing method. This feature may also be used to define an expected interface, automatically verified in client classes.

    如果在父类中使用@abstractmethod,那么子类中必须明确定义这个abstract method才能实例化,否则会报错。

    使用@abstractmethod的优点是,避免子类在编程过程中漏掉必要的method

    Java 中也有类似方法。

  • 相关阅读:
    Win32++ Home Page
    CEGUI Home Page
    迁移DirectX11到VS2015 Win10
    Oracle常用查看表结构命令
    PLSQL常用配置
    PLSQL DEVELOPER
    WeblogicException
    java.nio.Buffer
    spring batch
    vi
  • 原文地址:https://www.cnblogs.com/yaos/p/7101982.html
Copyright © 2011-2022 走看看