摘自http://www.codeproject.com

  • a struct is implicitly sealed, a class isn't.
  • a struct can't be abstract, a class can.
  • a struct can't call : base() in its constructor whereas a class with no explicit base class can.
  • a struct can't extend another class, a class can.
  • a struct can't declare protected members (eg fields, nested types) a class can.
  • a struct can't declare abstract function members, an abstract class can.
  • a struct can't declare virtual function members, a class can.
  • a struct can't declare sealed function members, a class can.
  • a struct can't declare override function members, a class can. The one exception to this rule is that a struct can override the virtual methods of System.Object, viz, Equals(), and GetHashCode(), and ToString().

  • 记得这种区别有在中文网站看过,但这个比较详细点!

    相关文章:

    • 2022-01-31
    • 2022-02-07
    • 2022-01-30
    • 2022-01-01
    • 2022-01-06
    猜你喜欢
    • 2022-01-21
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2021-11-08
    • 2021-08-18
    相关资源
    相似解决方案