CHAPTER 3
Classes 101
Classes are the heart of any application in an object-oriented language. This chapter is broken into several sections. The first section describes the parts of C# that will be used often, and the later sections describe things that won’t be used as often, depending on what kind of code is being written.
A Simple Class
A C# class can be very simple:
class VerySimple{ int m_simpleValue = 0;}class Test{ public static void Main() { VerySimple vs = new VerySimple(); }}
This class is a container for a single integer. Because the integer is declared without specifying how accessible it is, it’s private to the ...
Get A Programmer's Guide to C# 5.0, 4th Edition 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.