Java LESSON 7 Objects, Part 1

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Advertisements

Written by: Dr. JJ Shepherd
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Inheritance Inheritance Reserved word protected Reserved word super
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Road Map Introduction to object oriented programming. Classes
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to Classes and Objects Outline Introduction Classes, Objects, Member Functions and Data.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
Java Classes Using Java Classes Introduction to UML.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
10-Nov-15 Java Object Oriented Programming What is it?
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 4.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 – 9.4.
1 Object-Oriented Software Engineering CS Java OO Fundamentals Contents Classes and Objects Making new objects Method declarations Encapsulating.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Objects and Classes Start on Slide 30 for day 2 Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Much of.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Written by: Dr. JJ Shepherd
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
CS 116 Lecture 1 John Korah Contains content provided by George Koutsogiannakis & Matt Bauer.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
OOP Basics Classes & Methods (c) IDMS/SQL News
Comp1004: Building Better Objects II Encapsulation and Constructors.
Topic: Classes and Objects
GC211 Data structure Lecture 3 Sara Alhajjam.
OOP: Encapsulation &Abstraction
Classes C++ representation of an object
Concepts of Object Oriented Programming
Chapter 7 User-Defined Methods.
Classes and OOP.
Some Eclipse shortcuts
Writing Classes We have talked about classes and objects.
Final and Abstract Classes
Methods Chapter 6.
Review: Two Programming Paradigms
University of Central Florida COP 3330 Object Oriented Programming
Creating Your OwnClasses
CompSci 230 Software Construction
Class Variables We’ve seen how to add extra subroutines into our programs Can be accessed from within one another We can also add variables that are “global”
CMPE212 – Stuff… Exercises 4, 5 and 6 are all fair game now.
CS1S467 GUI Programming LECTURE 15 Methods (2 of 2)
Corresponds with Chapter 7
IFS410: Advanced Analysis and Design
Object-Oriented Programming
Encapsulation and Constructors
Chapter 9 Objects and Classes
Object-Oriented Programming
Defining Classes and Methods
Tonga Institute of Higher Education
Outline Anatomy of a Class Encapsulation Anatomy of a Method
Object-Oriented Programming
Object Oriented Programming in java
Introduction to Object-Oriented Programming
Review of Previous Lesson
Review of Previous Lesson
Classes C++ representation of an object
Lecture 18 Making C# Objects
Dr. R Z Khan Handout-3 Classes
Final and Abstract Classes
References Revisted (Ch 5)
Review for Midterm 3.
四時讀書樂 (春) ~ 翁森 山光照檻水繞廊,舞雩歸詠春風香。 好鳥枝頭亦朋友,落花水面皆文章。 蹉跎莫遣韶光老,人生唯有讀書好。
C++ Object Oriented 1.
Previous Lecture: Today’s Lecture: Reading (JV):
Presentation transcript:

Java LESSON 7 Objects, Part 1

Before We Start Objects... You now need a full understanding of: variables (types, declaration, initialisation) loops (while, for, do) conditionals (if, switch) methods (parameter lists, return types, scope) Otherwise you CAN’T understand Objects !

Why Objects ? History of Programming (abridged): In the beginning……. BASIC: the "Goto crisis" PROCEDURES (’Methods’ in Java) A little later…... Pascal, C, et al.: the "Software crisis" OBJECTS

Important: Encapsulation In Objects METHODS shield the DATA from other objects data method “talks to” another object… data method data method data method One object… Which in turn talks to others…

An Example: Re-Usability Consider a car:- A car manufacturer may use a component across a range of models e.g. locks and ventilation controls; Different car manufacturers may use the same component supplied by a single manufacturer e.g. tyres and wiper-blades. Re-Usability

Similarities Real Objects - Program Objects However the components must still be : Designed Once only Engineered / Built Repeatedly So too must software components and the programs which manipulate them.

Similarities Real Objects - Program Objects Blueprint or Plan = java class Designed Once only Engineered / Built Repeatedly Manufacturing Line = java object instances

Object Orientated Basics The state of an object is represented by the attributes of the object. The state of an object can be changed or interrogated via the methods.

Enough Theory Lets do it !

Object Orientated Example: “Car” Fundamentals (1 of 3) Consider Cars: We start with a single underlying “blueprint“ for the Cars we want to use Lots of Cars will then be instances (i.e. copies) of the same blueprint;

A Blueprint (an early method of making photocopies)

Instances (produced from the blueprint)

“Car” Fundamentals (2 of 3) Each Car instance (copy) can access methods such as (remember the lesson on methods ?): Setting the attribute changeSpeedBy getSpeed Interrogating the attribute In this example Car attributes (e.g. int speed, int direction ) store the state of the cars. attributes methods

“Car” Fundamentals (3 of 3) To summarise: We start with a single “blueprint” for Cars From that we can later build multiple instances (i.e. copies) of Cars Each Car instance has methods (i.e. can do things) The methods act on the attributes of each Car (i.e. speed, direction, etc.)

“Car” Object Implementation design once Car “Blueprint” - methods - attributes The ‘Car’ class Car.java Multiple builds Car 3 - methods - attributes Car 2 - methods - attributes Car 1 - methods - attributes The ‘UseCar’ class UseCar.java Car instances

General Structure of “Blueprints” Attributes (variables, constants) Class attributes Attributes which are identical for all objects created from the blueprint. e.g. "FORWARDS" for Cars - same for all. ‘static’ keyword public class NameOfClass { // Class attribute(s) go here // Object attribute(s) go here // Constructor(s) go here // Other methods go here // Optional ‘main’ method here } // end of the ‘blueprint’ class Objects attributes Variables which are copied into individual objects created from the blueprint. e.g. “state” (speed), - different for each. NO 'static' keyword

General Structure of “Blueprints” Methods (manipulate attributes) Constructor(s) Special method that creates a new object from the blueprint. Has same name as blueprint. public class NameOfClass { // Class attribute(s) go here // Object attribute(s) go here // Constructor(s) go here // Other methods go here // Optional ‘main’ method here } // end of the ‘blueprint’ class Other methods Usually so called ‘get’ and ‘set’ methods that manipulate the attributes. Possibly other ‘helper’ methods ’main’ method Not required, but may be used for testing and demonstration of usage

Car.java “Blueprint” Class attributes Objects attributes public class Car { // Class attribute(s) go here // Object attribute(s) go here // Constructor(s) // 'Set' and 'Get' methods Car.java “Blueprint” public static final int FORWARDS=1; public static final int BACKWARDS=0; private int speed; private int direction; Class attributes Attributes which are identical for all objects created from the blueprint. e.g. the constant FORWARDS for Cars - same for all. ‘static’ keyword ‘public’ keyword ‘final’ keyword public Car () { speed=0; direction=FORWARDS; } Objects attributes Variables which are copied into individual objects created from the blueprint. e.g. “state” (speed), - different for each ‘private’ keyword no 'static' Constructor(s) Special method that creates a new object from the blueprint. Has same name as the blueprint class (i.e. 'Car'). ‘public’ keyword no 'static' public void changeSpeedBy(int amount) { speed = speed + amount; if ( speed > 70 ) { speed = 70; } if ( speed < 0 ) { speed = 0; } // end of method 'changeSpeedBy' Other methods Usually so called ‘get’ and ‘set methods that manipulate the attributes. Other ‘helper’ methods ‘public’ keyword no 'static' ’main’ method Not required, but may be used for testing and demonstration of usage public int getSpeed() { return speed; } // end of method 'getSpeed' public void changeDirection() { if ( direction == FORWARDS ) { direction = BACKWARDS; } else { direction = FORWARDS; } // end of method 'changeDirection'

Non-OO Car vs. 'Car' blueprint public class Car { public static final int FORWARDS=1; public static final int BACKWARDS=0; private static int speed=0; private static int direction=FORWARDS; public static void changeSpeedBy(int amnt) { speed = speed + amnt; if ( speed > 70 ) { speed = 70; } if ( speed < 0 ) { speed = 0; } // end of method 'changeSpeedBy' public static int getSpeed() { return speed; } // end of method 'getSpeed' public class Car { // Class attribute(s) go here // Object attribute(s) go here // constructor(s) // 'Set' and 'Get' methods  public static final int FORWARDS=1; public static final int BACKWARDS=0; private int speed; private int direction; public Car () { speed=0; direction=FORWARDS; } The Car class from Lesson 6 on Methods public void changeSpeedBy(int amnt) { speed = speed + amnt; if ( speed > 70 ) { speed = 70; } if ( speed < 0 ) { speed = 0; } // end of method 'changeSpeedBy' public int getSpeed() { return speed; } // end of method 'getSpeed' 11/12/2018

“UseCar” Implementation design once  Car “Blueprint” - methods - attributes Multiple builds Car 3 - methods - attributes Car 2 - methods - attributes Car 1 - methods - attributes The ‘UseCar’ class UseCar.java Car instances

Building Cars (Constructing) (UseCar.java) public class UseCar { public static void main(String args[]) { Car car1 = new Car(); Car car2 = new Car(); System.out.print ( "Initial car speed : "); System.out.println ( car1.getSpeed()); System.out.println ( car2.getSpeed()); System.out.println ( "\nNow floor pedal of car1"); car1.changeSpeedBy( 300 ); } //end of main } // end of the UseCar class Compare 'constructing' to int x = 5; Car car1 = new Car(); Car car2 = new Car(); Class of object to construct Name of the object to construct Call the constructor Keyword "new" public Car () { speed=0; direction=FORWARDS; }

Using Cars (via Methods) (UseCar.java) public class UseCar { public static void main(String args[]) { Car car1 = new Car(); Car car2 = new Car(); System.out.print ( "Initial car speed : "); System.out.println ( car1.getSpeed()); System.out.println ( car2.getSpeed()); System.out.println ( "\nNow floor pedal of car1"); car1.changeSpeedBy( 300 ); } //end of main } // end of the UseCar class public int getSpeed() { return speed; } // end of method 'getSpeed' Output: car1 : 0 car2 : 0 dot Name of the object Method called returns speed

Using Cars (cont.) (UseCar.java) public void changeSpeedBy(int amnt) { speed = speed + amnt; if ( speed > 70 ) { speed = 70; } if ( speed < 0 ) { speed = 0; } // end of method 'changeSpeedBy' public class UseCar { public static void main(String args[]) { Car car1 = new Car(); Car car2 = new Car(); System.out.print ( "Initial car speed : "); System.out.println ( car1.getSpeed()); System.out.println ( car2.getSpeed()); System.out.println ( "Now floor pedal of car1"); car1.changeSpeedBy( 300 ); } //end of main } // end of the UseCar class Output: car1 : 70 car2 : 0

  Done ! Car instances design once Car “Blueprint” - methods - attributes  Multiple builds Car 3 - methods - attributes Car 2 - methods - attributes Car 1 - methods - attributes Car instances

Review: Object Orientated Basics The state of an object is represented by the attributes (object variables) of the object. (Object variables 'speed' and 'direction') The state of an object can be changed or interrogated via the methods. (changeSpeedBy( int amnt ) , getSpeed() )

Review: “Car” Fundamentals We start with a single underlying “blueprint“ for the Cars we want to use (The 'Car' class in 'Car.java') Lots of Cars will then be instances (i.e. copies) of the same blueprint; (The 'UseCar' class in 'UseCar.java')

Review: “Car” Fundamentals Each Car instance (copy) can access methods such as: Setting the attribute changeSpeedBy getSpeed Interrogating the attribute In this example a Car attributes (e.g. int speed, int direction ) store the state of the cars. attributes methods

Review: The keyword 'static' 'static' methods and variables (usually constants) exist only once for all copies made from the 'blueprint'. These methods or variables are then called 'class' methods or 'class' variables public static final int FORWARDS=1; public static final int BACKWARDS=0; If methods and class variables (rarely constants) are declared WITHOUT 'static' a separate copy is made for each instance produced from the 'blueprint' These methods or variables are then called 'object' methods or 'object' variables private int speed=0; private int direction=FORWARDS;

Review: 'private' Object Variables Object variables (i.e. no 'static'), declared 'private' can NOT be accessed directly from other classes (e.g. UseCar.java) The reason for this 'encapsulation' is 'safety'. Access to these variables is ONLY indirectly via public methods. private int speed=0; private int direction=FORWARDS; public void changeSpeedBy(int amnt) { speed = speed + amnt; if ( speed > 70 ) { speed = 70; } if ( speed < 0 ) { speed = 0; } // end of method 'changeSpeedBy'

Review: Constructors Can be thought of as factories turning blueprints (the 'Car' class) into 'real' (well…) objects. Once "constructed" an object 'exists' (i.e. has its own space inside the memory). It has: a name (car1, car2, myCar, andrewsWreck) attributes (speed, direction) a state (values stored in 'speed', 'direction') methods (changeSpeedBy(…), getSpeed() ) Car car1 = new Car();

Review: Methods Can manipulate and interrogate the state of objects. Scope Returned type Method name (Formal parameter list) body of the method where computations are made return statement (if anything gets returned) { } // end of method Can manipulate and interrogate the state of objects. Are often 'public' and then act as "safety filters" to prevent damage (more about that next week). Are accessed using the ObjectName-dot-methodName convention. Method Call Returned parameter = Method name (Actual parameter list) ;

And now: Let’s repeat.... Then: how to use objects The ‘Car' example re-packaged as a 'Switch' Then: how to use objects more about 'constructing' testing Finally: The concept of inheritance don't re-invent the wheel re-usability

Object Orientated Example: “Switch” Fundamentals (1 of 2) Consider Switches: We start with a single underlying “blueprint“ for the Switches we want to use Lots of Switches will then be instances (roughly "copies") made from the same blueprint;

“Switch” Fundamentals (2 of 2) Each Switch instance ("copy") can access methods such as: Changing the attribute turnOn, turnOff getStatus Interrogating the attribute attributes methods In this example a single Switch attribute (e.g. int state) stores the state of the Switch.

“Switch” Implementation (1 of 4) design once Switch “Blueprint” - methods - attributes ‘Switch’ class Switch.java Multiple builds Switch 3 - methods - attributes Switch 2 - methods - attributes Switch 1 - methods - attributes ‘UseSwitch’ class UseSwitch.java Switch instances

General Structure of “Blueprints” Attributes (variables, constants) Class attributes Attributes which are identical for all objects created from the blueprint. e.g. "ON" for Switches - same for all. ‘static’ keyword public class NameOfClass { // Class attribute(s) go here // Object attribute(s) go here // Constructor(s) go here // Other methods go here // Optional ‘main’ method here } // end of the ‘blueprint’ class Object attributes Variables which are copied into individual objects created from the blueprint. e.g. “state”, - different for each. NO 'static' keyword

General Structure of “Blueprints” Constructor(s) Special method that creates a new object from the blueprint. Has same name as blueprint. Other methods Usually so called ‘get’ and ‘set’ methods that manipulate the attributes. Possibly other ‘helper’ methods Methods (manipulate attributes) ’main’ method Not required, but may be used for testing and demonstration of usage public class NameOfClass { // Class attribute(s) go here // Object attribute(s) go here // Constructor(s) go here // Other methods go here // Optional ‘main’ method here } // end of the ‘blueprint’ class

Switch.java “Blueprint” public class Switch { // Class attribute(s) go here // Object attribute(s) go here // constructor(s) // Other methods } // end of the Switch class Switch.java “Blueprint” public static final int ON = 1; public static final int OFF = 0; private int state = OFF; Class attributes Attributes which are identical for all objects created from the blueprint. e.g. the constant ON for Switches - same for all. ‘static’ keyword usually 'public' keyword ‘final’ if constants public Switch () { state=OFF; } Objects attributes Variables which are copied into individual objects created from the blueprint. e.g. “state”, - different for each Switch ‘private’ keyword No ‘static’ Constructor(s) Special methods that create a new object from the blueprint. Has same name as the blueprint class (i.e. 'Switch'). Returns a "Switch" object ‘public’ keyword public void turnOn() { state = ON; } public void turnOff() { state = OFF; public String getStatus() { if ( state == ON ) return “On”; else return “Off”; Other methods Usually so called ‘get’ and ‘set methods that manipulate the attributes. Other ‘helper’ methods ‘public’ keyword ’main’ method Not required, but may be used for testing and usage demonstration

“Switch” Implementation (1 of 4) design once  Switch “Blueprint” - methods - attributes Multiple builds Switch 3 - methods - attributes Switch 2 - methods - attributes Switch 1 - methods - attributes ‘UseSwitch’ class UseSwitch.java Switch instances

Building and Using Switches UseSwitch.java public class UseSwitch { public static void main(String args[]) { Switch switch1 = new Switch(); Switch switch2 = new Switch(); System.out.println ( "Initial switch states : "); System.out.println ( switch1.getStatus()); System.out.println ( switch2.getStatus()); System.out.println ( "Now turn switch 1 on"); switch1.turnOn(); } //end of main } // end of the UseSwitch class

Building and Using Cars UseCar.java public class UseSwitch { public static void main(String args[]) { Switch switch1 = new Switch(); Switch switch2 = new Switch(); System.out.println ( "Initial switch states : "); System.out.println ( switch1.getStatus()); System.out.println ( switch2.getStatus()); System.out.println ( "Now turn switch 1 on"); switch1.turnOn(); } //end of main } // end of the UseSwitch class Call the constructor Class of object to construct Keyword "new" Name of the object to construct public Switch () { state=OFF; } Compare 'constructing' to int x = 5;

Building and Using Switches UseSwitch.java public String getStatus() { if ( state == ON ) return “On”; else return “Off”; } public class UseSwitch { public static void main(String args[]) { Switch switch1 = new Switch(); Switch switch2 = new Switch(); System.out.println ( "Initial switch states : "); System.out.println ( “switch1: “ + switch1.getStatus()); System.out.println ( “switch2:” + switch2.getStatus()); System.out.println ( "Now turn switch 1 on"); switch1.turnOn(); System.out.println ( switch1.getStatus()); System.out.println ( switch2.getStatus()); } //end of main } // end of the UseSwitch class Output: switch1 : Off switch2 : Off dot Name of the object Method called returns state

Building and Using Switches UseSwitch.java public void turnOn() { state = ON; } public String getStatus() { if ( state == ON ) return “On”; else return “Off”; public class UseSwitch { public static void main(String args[]) { Switch switch1 = new Switch(); Switch switch2 = new Switch(); System.out.println ( "Initial switch states : "); System.out.println ( “switch1: “ + switch1.getStatus()); System.out.println ( “switch2: “ + switch2.getStatus()); System.out.println ( "Now turn switch 1 on"); switch1.turnOn(); System.out.println ( “switch1:” + switch1.getStatus()); System.out.println ( “switch2” + switch2.getStatus()); } //end of main } // end of the UseSwitch class Output: switch1 : On switch2 : Off

  Done ! Switch instances design once Switch “Blueprint” - methods - attributes  Multiple builds Switch 3 - methods - attributes Switch 2 - methods - attributes Switch 1 - methods - attributes Switch instances

Review: Object Orientated Basics The states of an object are represented by the (usually private) attributes of the object. (Object variable 'state') The states of an object can be changed or interrogated via the (usually public) methods . (turnOn, turnOff , getStatus() ) This means that the private attributes are protected from unauthorised access by the public methods. The methods act as gatekeepers to the data. The data are ENCAPSULATED (next slide)

Important: Encapsulation In Objects METHODS shield the DATA from other objects data method “talks to” another object… data method data method data method One object… Which in turn talks to others…

Review: “Switch” Fundamentals We start with a single underlying “blueprint“ for the Switches we want to use (The 'Switch' class in 'Switch.java') Lots of Switches will then be instances (i.e. "copies") of the same blueprint; (The 'UseSwitch' class in 'UseSwitch.java')

Review: “Switch” Fundamentals Each Switch instance ("copy") can access methods such as: Changing the attribute turnOn, turnOff getStatus Interrogating the attribute attributes methods In this example a single Switch attribute (e.g. int state) stores the state of the Switch.

Review: The keyword 'static' 'static' methods and variables (or constants) exist only once for all copies made from the 'blueprint'. These methods or variables are then called 'class' methods or 'class' variables public static final int ON=1; public static final int OFF=0; If methods and class variables (rarely constants) are declared WITHOUT 'static' a separate copy is made for each instance produced from the 'blueprint' These methods or variables are then called 'object' methods or 'object' variables private int state=ON;

Constructors: We already know…. Can be thought of as factories turning blueprints (the 'Switch' class) into 'real' (well…) objects. Once "constructed" an object 'exists'. (i.e. has its own space inside the memory) It has: a name (switch1, switch2, mySwitch,….) attributes (state) a state (values stored in 'state') methods (turnOn(), turnOff(), getStatus() ) Switch switch1 = new Switch();

Constructors: And this is new…. There can be more than 1 constructor in a class: 'blueprint' Switch class UseSwitch class public Switch (int initialState) { state=initialState; } // end of second constructor Switch switch2 = new Switch( Switch.ON ); public static final int ON = 1; public static final int OFF = 2; public Switch () { state=OFF; } // end of DEFAULT constructor Switch switch1 = new Switch();

Remember the 'Car' class ? Is this a good idea? Think ‘Safety’ 'blueprint' Car class UseCar class public static final int FORWARDS=1; public static final int BACKWARDS=0; public Car () { speed=0; direction=FORWARDS; } // end of DEFAULT constructor Car car1 = new Car(); public Car (int iniSpeed) { speed=iniSpeed; direction=FORWARDS; } // end of second constructor Car car2 = new Car( 500 ); Is this a good idea? Think ‘Safety’ public Car (int iniSpeed, int iniDir) { speed=iniSpeed; direction=iniDir; } // end of third constructor Car car3 = new Car(30, Car.FORWARDS);

Use "Safety" Features Instead of: Better use: public Car (int iniSpeed) { speed=iniSpeed; direction=FORWARDS; } Car car2 = new Car( 500 ); Better use: public Car (int iniSpeed) { setSpeed( iniSpeed ); direction=FORWARDS; } public void setSpeed(int spd) { if ( spd > 70 ) { spd = 70; } if ( spd < 0 ) { spd = 0; speed = spd; } // end of method 'setSpeed'

Testing the "Blueprint" Testing and to give a The "Switch" and the "Car" class don't have a 'main' method. (Not required for function) However, it is a good idea to do some Testing and to give a Demonstration of how to use the class Therefore:……….

// Class attribute(s) go here public class Switch { // Class attribute(s) go here // Object attribute(s) go here // constructor(s) // Other methods } // end of class Switch public static final int ON = 1; public static final int OFF = 2; private int state = OFF; public Switch () { state=OFF; } // main method to test and demonstrate public static void main(String args[ ]) { Switch switch1 = new Switch(); Switch switch2 = new Switch(); System.out.println ( "Initial switch states : "); System.out.println ( switch1.getStatus()); System.out.println ( switch2.getStatus()); System.out.println ( "\nNow turn switch 1 on"); switch1.turnOn(); } // end of main public void turnOn() { state = ON; } // end of turnOn public void turnOff() { state = OFF; } // end of turnOff public String getStatus() { if ( state == ON ) return “On”; else return “Off”; } // end of getStatus 11/12/2018

Today's Content The use of Objects requires: a ‘template‘ class that defines the Object a ‘use’ class that ‘instantiates’ the Object(s) using ‘constructors’ private object attributes are encapsulated safely by public accessor methods public class attributes tend to be constants and thus do not need this protection

END OF LESSON 7