O'Reilly logo

A Programmer's Guide to C# 5.0, 4th Edition by Nick Wienholt, Eric Gunnerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 3

image

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required