#228 – Object-Oriented Programming in C# Using Classes

Classes are the construct in C# that enable the object-oriented paradigm and make C# an object-oriented language.

Classes are the user-defined types that define a set of related data and the methods that act upon that data.  Each instance of the class (an object) has a set of values for the class’ data, know as the object’s state.

Object-orientation is a powerful paradigm to use when writing software because using classes and objects helps you think about things, rather than algorithms.

For example, we might have a Dog class with data fields like: Name, Age, Breed, LikesBalls, and PersonalityType.  We might have methods in the Dog class like Bark, Sit, and Fetch.  Each instance of a Dog would have different values for these fields and we can call any of the Dog methods on an instance of a dog and it would respond based on the value of these fields.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #228 – Object-Oriented Programming in C# Using Classes

  1. Pingback: #757 – Books on Object-Oriented Programming « 2,000 Things You Should Know About C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: