...

/

Introduction to Objects and Classes

Introduction to Objects and Classes

In this section, you will get familiar with the basic building blocks of object-oriented programming: Objects and Classes.

Definitions

A class can be thought of as a user-defined blueprint or prototype used for creating objects. In other words, a class specifies what properties an object should have and how it should behave.

We referred to classes as the blueprints for creating objects. When looking at it from an object’s perspective we can say that objects are the run time instances of classes. This may not make much sense right now, but we will look into it practically by creating our own objects soon.

From the above discussion we can infer that:

An object is an instance of a class.

In C#, we have several different data types like int, char, bool etc. We can use any of these types in the program, but they provide very ...