Object Oriented Programming
- Class Diagrams:
- Lets draw a sample class diagram of Company, Department and Employee (Without representing relationships b/w them)
- Lets draw a sample class diagram of Company, Department and Employee (Without representing relationships b/w them)
Association, Aggregation and Composition
-
Association: This represents the unidirectional or bidirectional relationship b/w two classes.
-
Associations are of two types
- Aggregation: An object can exist even if the object of control class is dead (Company, Building)
- Composition: An object also will be dead if the object of control class is dead (Company, Department)
-
Lets create a Class Diagram for a Library
- Librarian
- Book
- User
-
Generally relationships b/w classes can be classified into two major categories
- is-a
- has-a: Represents aggregation/composition
-
Lets create a Class Diagram for Movie Booking
- Movie
- Theatre
- Screen
- User
- Ticket
-
Exercise: Create a Class Diagram For Bank with ATM for ATM Operations
- Bank
- Customer
- Account
- Teller