.NET class inherits object class by default. How?

后端 未结 3 1709
猫巷女王i
猫巷女王i 2021-01-22 04:54

When we create a class Product

class Product
{
}

What I have learned from different blogs and books that Object class is the super

3条回答
  •  深忆病人
    2021-01-22 05:22

    Yup, it's taken care by .Net Framework. Every Type inf is stored in a special table in memory when program is running. And type record contains link to a base class record. Every type that is not derived from any class contains a link to an object record.

    Through this every type has methods, that are defined in a MethodTable (also in memory when .Net framework is running) as methods of object class. For example GetHashCode or Equals

提交回复
热议问题