I. What is Object Oriented Programming?
1.1 Examples:
C | MODSIM III |
job=reportposition;
car54position=task(car54,job); /|\ action task(car54,job) { if(job.eq.reportposition) x=position(car54); else x= ...; return x; } |
ASK Car54 TO
ReportPosition
/|\ /|\ object method /|\ one of several methods Note: object includes methods (functions) and fields (data). In this case field
of object is
hidden, it is the
|
MODSIM III statement: | Explanation: |
ASK Vehicle TO
Stop
ASK Aircraft TO Stop ASK Bike TO Stop ASK Boat TO Stop /|\ /|\ object method |
Object's stop method
sets speed field value to 0.
Different objects can be given same generic method, but different behavior |
CarSpeed := ASK
Vehicle speed
/|\ /|\ /|\ field of object1 object2 field |
Field value of another object can be obtained through
statement
|
1.4. Characteristics: