OOP using C++
Classes & Objects
, Objects and Classes
• OO Programming Concepts
• Creating Objects and Object Reference Variables
– Differences between primitive data type and object type
– Automatic garbage collection
• Constructors
• Modifiers (public, private and static)
• Instance and Class Variables and Methods
• Scope of Variables
• Use the this Keyword
• Case Studies (Mortgage class and Count class)
, OO Programming Concepts
An object A Circle object
Data Field
data field 1
radius = 5
... State
Method
data field n findArea
method 1
... Behavior
method n
, Class and Objects
Circle UML Graphical notation for classes
radius: double UML Graphical notation for fields
UML Graphical notation for methods
findArea(): double
new Circle() new Circle()
circle1: Circle circlen: Circle UML Graphical notation
for objects
radius = 2 ... radius = 5