You must always remember to post the error message that you receive.
I am thinking your problem is that you don't forward-declar ethe class PatientHeightAndWeight.
Also note that you are creating copies of this class whenever you create a class of type BMI. You should change this paramter to take the class as const and by reference.
I'm sorry forgot about that.
It show me error in class BMI. It mention that the height and weight is undeclared.
I wondering that if there is any ways to link three classes together using the friend function.
Thank you.
PatientHeightAndWeight doesn't have any members named Height or Weight. Also, the friend class within Patient is redundant since there're no private members of PatientHeightAndWeight.
This is the error when i run the above code:
`BMI::BMI(PatientHeightAndWeight)':
27 'class PatientHeightAndWeight' has no member named 'Height'
28 'class PatientHeightAndWeight' has no member named 'Weight'
31 'class PatientHeightAndWeight' has no member named 'Weight'
31 'class PatientHeightAndWeight' has no member named 'Height'
31 'class PatientHeightAndWeight' has no member named 'Height'