esse quam videri
Jump to: navigation, search


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.

Class types include 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.

When defining a class, you use the following structure (known as a class definition):

(access modifier) (class type) class (identifier) : (parent class, if applicable) {


If you are programming within an Object-Oriented paradigm, you will be using classes in order to fulfill the principles of Encapsulation, Abstraction, DRY, and many more. The use of classes is integral to success when programming in many of the languages taught at Columbia College Chicago, such as C++ and C#. In the Introduction to Programming and Object-Oriented courses you will learn more about classes and use them in every assignment you encounter.


See also

- Abstract Class

- Inheritance

- Encapsulation

- Object Oriented Programming

- Object

Additional Links

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