Chapter 2: Showing Some Class

In This Chapter

check.png Introducing the C# class

check.png Storing data in an object

check.png Assigning and using object references

check.png Examining classes that contain classes

check.png Identifying static and instance class members

check.png Using constants in C#

You can freely declare and use all the intrinsic data types — such as int, double, and bool — to store the information necessary to make your program the best it can be. For some programs, these simple variables are enough. However, most programs need a way to bundle related data into a neat package.

As shown in Book I, C# provides arrays and other collections for gathering into one structure groups of like-typed variables, such as strings or ints. A hypothetical college, for example, might track its students by using an array. But a student is much more than just a name — how should this type of program represent a student?

Some programs need ...

Get C# 5.0 All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.