Changes

Jump to: navigation, search

C Sharp Object Oriented Programming

689 bytes added, 16:47, 18 January 2008
Creating C# Class Members
Now that we have defined the properties of our class, the next task is to learn how to create an object from the class and access some of the class members.
 
== Instantiating an Object from a C# Class ==
 
The process of creating an object from the class 'blueprint' is called instantiation. The first step is to create an object variable of the required object type. An instance of the object is then created using the ''new'' keyword and assigned to the object variable:
 
<pre>
BankAccount custAccount;
 
custAccount = new BankAccount();
</pre>
 
It is also poossible to declare the object variable and assign the object in a single statement:
 
<pre>
BankAccount custAccount = new BankAccount();
</pre>
 
Now that we have an instance of our BankAccount class the next step is learn how to access the members of the class.
== Defining Class Methods ==

Navigation menu