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.

        class-declaration:                attributesopt class-modifiersopt partialopt class identifier type-parameter-listopt                                            class-baseopt type-parameter-constraints-clausesopt class-body ;opt

A class-declaration consists of an optional set of attributes ...

Get The C# Programming Language, Third 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.