Friday, July 13, 2007

Creating Objects For jablaykita

jablaykita

Creating Objects
Now that you know how to create basic classes, creating objects (or instances)
based upon them is the logical next step. Creating a variable that contains an
object takes two steps. First, like any variable, you must declare the variable
name for the object and its type somewhere in your program. You perform this
step by using the class name as the data type and whatever name you want for
the variable. The following code is an example of this process for the Vehicle
class:
http://greateventsupport.com/
Vehicle myVehicle;
At this point, much like an array, nothing is in the variable yet. All you have
done is state that eventually myVehicle will contain an object. Next you need
to create the object.
Creating Objects
Now that you know how to create basic classes, creating objects (or instances)
based upon them is the logical next step. Creating a variable that contains an
object takes two steps. First, like any variable, you must declare the variable
name for the object and its type somewhere in your program. You perform this
step by using the class name as the data type and whatever name you want for
the variable. The following code is an example of this process for the Vehicle
class:
http://greateventsupport.com/
Vehicle myVehicle;
At this point, much like an array, nothing is in the variable yet. All you have
done is state that eventually myVehicle will contain an object. Next you need
to create the object.

No comments:

Post a Comment