C++ Program: Association in class Example :Write a code to associate Two class

 


The association is in a relationship between two classes.In this type of relationship, both classes know about the connection.

Following Example :

  • Make three-class Person, Woman , Man
  • A person has a class inheritance in Woman and man class 
  • Man and Woman class has friend function marry to show they are married 
  • Man and woman can do more than one marriage so its multiplicities example 

Raj marry to Pooja

Pooja and raj are not married not now
Sammer marry to Pooja

0 Comments