Monday, 8 February 2016

Relationship in Java

By
There are three type of relationships in java
  • Generalized and Specialization(is a -relationship)
    • A class is similar to other class
    • A class is different type of another class. 
         
  • Aggregation(has a -relationship)
    • A class has a Object of other class as member variable
    • Another class is part of class
    • Every customer have Address
    • Relationship between Address class and Customer class is Has-a relationship
  • Association (uses a-relationship)

    • loosely coupled relationship
    •  A class interact with other class

      • Every bill payment have some header to it so Purchase class uses PrintHeader class to print the header
      • Relationship between purchase class and PrintHeader class is Uses_a relationship
    Implementation of Relationship 
    • Inheritance
    • Aggregation
    • Association

    0 comments :

    Post a Comment