Escolar Documentos
Profissional Documentos
Cultura Documentos
Programming (OOP)
Lecture No. 1
Course Objective
Object-Oriented Software
Engineering
By Jacobson, Christerson, Jonsson,
Overgaard
Grading Policy
A model is an abstraction of
something
Highway maps
Architectural models
Mechanical models
Example OO Model
Example OO Model
Objects
Ali
House
Car
Tree
Interactions
Ali lives in the house
Ali drives the car
Object-Orientation -
Advantages
People think in terms of objects
State (attributes)
Well-defined behaviour (operations)
Unique identity
Example Ali is a Tangible
Object
State (attributes)
Name
Age
behaviour (operations)
Walks
Eats
Identity
His name
Example Car is a Tangible
Object
State (attributes)
- Color
- Model
behaviour (operations)
- Accelerate - Start Car
- Change Gear
Identity
- Its registration number
Example Time is an Object
Apprehended Intellectually
State (attributes)
- Hours - Seconds
- Minutes
behaviour (operations)
- Set Hours - Set Seconds
- Set Minutes
Identity
- Would have a unique ID in the model
Example Date is an Object
Apprehended Intellectually
State (attributes)
- Year - Day
- Month
behaviour (operations)
- Set Year - Set Day
- Set Month
Identity
- Would have a unique ID in the model
What is pointer
Apointeris a variable whose value
is the address of another variable.
Like any variable or constant, you
must declare a pointer before you
can work with it.
The general form of a pointer
variable declaration is:
type *var-name;
Using Pointers in C++:
#include <iostream>
using namespace std;
int main () { int var = 20; // actual variable declaration.
int *ip; // pointer variable
ip = &var; // store address of var in pointer variable
cout << "Value of var variable: ";
cout << var << endl;
// print the address stored in ip pointer variable
cout << "Address stored in ip variable: ";
cout << ip << endl;
// access the value at the address available in pointer
cout << "Value of *ip variable: ";
cout << *ip << endl;
return 0; }