As done for variables of primitive types, you can
create a reference to a class using a declared variable. The same rule
applies: the object that is used as a reference must have been previously
initialized.

Practical
Learning: Introducing Pointers and Classes

To start a new program, launch Microsoft Visual C++ 2005

On the main menu, click File -> New -> Project...

On the left side, make sure that Visual C++ is selected. In the Templates
list, click CLR Empty Project

In the Name box, replace the string with RealEstate5 and click OK

To create a source file, on the main menu, click Project -> Add New
Item...

After declaring a pointer to a class, to use it, you can
access one, a few, or all of its members. You have a choice between two
operators: the period and the arrow.

We saw that the asterisk "*" on the
left side of a pointer represented the value of the variable. In the case of a
class, when writing *sqr, this represents a CSquare object and it holds the
values of the object to which it would have been initialized. To access its members, yon can
use the period operator that is used to
access the values of an object. Because the period has a higher precedence than
the asterisk, you must include the object and its asterisk between
parentheses. Here is an example:

Using a pointer allows
you to use memory only as needed. This is done by using the asterisk
* and the new operators. The syntax of declaring a pointer to a class is:

ClassName* VariableName= new ClassName;

The ClassName is the class whose variable you want
to declare. It could be in the program or one that shipped with the compiler.
Once again, the asterisk lets the compiler know that the object is declared as a
pointer. The variable name follows the same rules we have applied to other
variables so far.

After declaring the pointer, you can access each of its
members and assign it an
appropriate value. Here are examples: