-
Book Overview & Buying
-
Table Of Contents
Fundamentals for Self-Taught Programmers
By :
As you learned in the previous section, OOP is centered around the concept of objects, which are abstract representations of things in the real world. Anything that can be considered a noun, such as patients, landmarks, or an address, can be represented as objects in code.
In the C# language and most OOP languages, the process of creating any object begins with a class, which is a code block containing values and methods that are used to describe what an object is and what it does. Consider the C# variable in the following example:
string animal = "Cat";
A cat is an animal, but it would be helpful to have more information about it. How old is it? Where’s its natural habitat? How can it be described? A variable in this state can’t really provide many details about it. What if we converted the variable into an array like in the following example?
string animal[] = {"Cat", "White", 2};
With an array like...