X hits on this document

PDF document

“Beginning Visual C# 2005 Express Edition Video Series” - page 37 / 73





37 / 73

Also, all cars can go to the same gas stations and fill up using the same gas pumps, despite the fact that a Mercedes may cost $60,000 more than a Hyundai. This is known as Polymorphism, meaning that even though there are different objects, you can interact with them the same way because they both derive from the ideal car.

So, when defined in this way, I hope you can begin to see the value of looking at software the way we analyze the world around us.

For this lesson, we'll focus on the most basic building block of OO programming, and that is the Class. A class is simply a blueprint. The Class defines the fields, properties, methods and events that an object will have.

A class is a blueprint only; its only job is to define what data it should store (the variables, or rather Fields) and what actions the object should take (the procedures, or rather the Properties and Methods). But since a class is just a blueprint, it is not the ACTUAL object … just a definition of the object’s appearance, behaviors, etc.

Just like in the real world, you take a blueprint to a contractor, or take the recipe to a baker and they create an instance of that blueprint, resulting in a house or a cookie respectively. In our case, we'll create an instance of the class. The instance is a manifestation of that class, which we then call an Object. So lets define a class:


class Car {


This class does nothing. So let’s add some fields, properties and methods.

Supplemental Readings for the Express Edition Videos Copyright © 2005 LearnVisualStudio.NET


Document info
Document views273
Page views273
Page last viewedMon Jan 23 13:30:52 UTC 2017