简体   繁体   English

派生类是基类的实例吗?

[英]Is the derived class an instance of the base class?

When we create a new derived class is it considered as an instance of the base class? 创建新的派生类时,是否将其视为基类的实例? the derived class will have all the functions and attribute that any instance of the base class have. 派生类将具有基类任何实例具有的所有功能和属性。

  • The derived class is usually called a subclass of the base class(es). 派生类通常称为基类的类。

  • Instances of the derived class are also instances of the base class(es). 派生类的实例也是基类的实例。

  • The derived class is not an instance of the base class, but it is an instance of the base class metaclass , unless the derived class overrides the metaclass. 派生类不是基类的实例,但它是基类类的实例 ,除非派生类重写元类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自派生类实例的 Pickle 基类 - Pickle base class from derived class instance 访问派生类中更改的基类实例属性 - Access changed base class instance attribute in derived class Python 类型注释,例如派生自抽象基础 class 的 class 实例 - Python type annotations for instance of class derived from abstract base class 如何在Python中从基类访问派生类的实例变量 - How to access an instance variable of a derived class from a base class in Python 是否可以从基类的实例创建派生类型的实例 - Is it possible create instance of derived type from instance of base class 我可以使用其基础 class 的实例来初始化派生数据类吗? - Can I init a derived dataclass using an instance of its base class? 注释“从特定基类派生的子类的实例” - Annotating "Instance of a subclass derived from specific base class" Python:Pickle派生类,就好像它们是基类的实例一样 - Python: Pickle derived classes as if they were an instance of the base class C#基类方法无法读取派生类中的实例属性 - C# base class method can not read instance attribute which is in derived class 如何提示返回调用它的派生类实例的基类函数? - How to hint base class function that returns an instance of derived class it is called from?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM