Class

esse quam videri
Revision as of 19:45, 8 February 2020 by Kspriggs01 (talk | contribs) (Definition)
Jump to: navigation, search

Definition

A class is like a blueprint for an object, it defines what kind of information it has to have and what kinds of things it will be able to do.

Inside a class declaration, there can be fields, properties, methods, and events.

Each class should be designed to only accomplish one specific task, therefore a complete program will use many different classes.

Classes can inherit properties and methods from other classes if they are a child of that class. This concept is known as Class Inheritance.

How to Create a Class

You can choose to create a new .cs file in order to store your new class, or you can declare it within the same .cs file as another class. The former is recommended so you can clearly identify which files correspond to which classes.

Classes can be static, abstract, and/or partial.

Access modifiers that are applicable to methods and variables are also able to be used in their declarations (such as public, private, or protected).

Each class needs to have an identifier set for them, just like with variables.

Relevance

Resources

See also

- Abstract Class

- Inheritance

- Encapsulation

- Object Oriented Programming

- Object

Additional Links

Programming Tutorial: Classes Part 1
Programming Tutorial: Classes Part 2