10. Classes

A class is a data structure that may contain data members (constants and fields), function members (methods, properties, events, indexers, operators, instance constructors, destructors, and static constructors), and nested types. Class types support inheritance, a mechanism whereby a derived class can extend and specialize a base class.

10.1 Class Declarations

A class-declaration is a type-declaration9.6) that declares a new class.

image

A class-declaration consists of an optional set of attributes (§17), followed by an optional set of class-modifiers10.1.1), followed by an optional partial modifier, followed by the keyword class ...

Get The C# Programming Language (Covering C# 4.0), Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.