01-11-2012, 02:31 PM
Object Oriented Programming
Object Oriented 1.PPT (Size: 46.5 KB / Downloads: 30)
Instantiation Details
If we don’t instantiate our object,
it will have the special value null
Using a null object is incorrect
When we instantiate an object
We set aside memory for the object’s state information
We identify the methods
Create them if this is first of this object
Refer to them if they already exist
We perform any required initialization and processing
Class, Method, & Data Accessibility
Any method within a class can see any other method in that same class
Any data or object declared as a member of the class (not as a member of a method) is visible throughout the class
Any data declared within a method are local to that method and are not visible anywhere else.
Working With Classes
When we define a class
We define capabilities and state
We can further enhance and refine that class
We can make a modified class based on the original
This is a new and different plan,
Not just a new and different object
The Java keyword extends
Allows us to create a new class definition based on a previously existing one, and then refine that.
Java Inheritance
We use the keyword extends
class child extends parent
The child has access to all the features of the parent
data
methods
Except
No direct access to those identified as private
Class Enhancement
We use the keyword extends to create a new class based on a previous one
We get all of the public and protected data
We get all of the public and protected method
We can add more as our design requires
Objects versus Classes
We can make objects based on either one
The data is unique to each objet
except for static data
Object Oriented 1.PPT (Size: 46.5 KB / Downloads: 30)
Instantiation Details
If we don’t instantiate our object,
it will have the special value null
Using a null object is incorrect
When we instantiate an object
We set aside memory for the object’s state information
We identify the methods
Create them if this is first of this object
Refer to them if they already exist
We perform any required initialization and processing
Class, Method, & Data Accessibility
Any method within a class can see any other method in that same class
Any data or object declared as a member of the class (not as a member of a method) is visible throughout the class
Any data declared within a method are local to that method and are not visible anywhere else.
Working With Classes
When we define a class
We define capabilities and state
We can further enhance and refine that class
We can make a modified class based on the original
This is a new and different plan,
Not just a new and different object
The Java keyword extends
Allows us to create a new class definition based on a previously existing one, and then refine that.
Java Inheritance
We use the keyword extends
class child extends parent
The child has access to all the features of the parent
data
methods
Except
No direct access to those identified as private
Class Enhancement
We use the keyword extends to create a new class based on a previous one
We get all of the public and protected data
We get all of the public and protected method
We can add more as our design requires
Objects versus Classes
We can make objects based on either one
The data is unique to each objet
except for static data