Classes and Multiform Projects
Classes and Multiform Projects
Chapter 9
Classes and
Multiform Projects
Topics
9.1 Introduction to Classes
9.2 Properties
9.3 Parameterized Constructors and Overloading
9.4 Storing Class Type Object in Arrays and Lists
9.5 Finding the Classes and Their Responsibilities in a
Problem
9.6 Creating Multiple Forms in a Project
Class headers starts with the keyword class, followed by the name
of the class.
Member declarations are statements that define the classs fields,
properties, and/or methods.
A class may contains a constructor, which is special method
automatically executed when an object is created.
where,
myCoin is a variable that references an object of the Coin class;
the new keyword creates an instance of the Coin class; and
the = operator assigns the reference that was returned from the
new operator to the myCoin variable.
Once a Coin object is created, you can access members
of the class with it. E.g.
myCoin.Toss();
set
{
_name = value;
}
}