Why do bd is added to constructor in this code? | Sololearn: Learn to code for FREE!

0

Why do bd is added to constructor in this code?

plsease help me out. I want to know what is the role of bd in the constructor I know how this code has printed date and name of the person. but why bd added to constructor and bd is assigned as value of bd in main function. Code is given.......... in this site https://code.sololearn.com/cZTTW211oOW2/?ref=app

4/29/2017 9:00:57 AM

Harikrishnan s

1 Answer

New Answer

+5

1) Birthday(int m, int d, int y){.....} 2) Person(string n, Birthday b){.....} 3) Birthday bd(2, 21, 1985); 4) Person p("David", bd); notice line 2 Person constructor have a Birthday as a parameter that is the reason bd is passed along when creating the Person instance