We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Firstly make the getdata() function is virtual function after that taking input from user using cin object and name, age are the class instance variable of the same class.(this-> it is a reference of the same class instance member variables. )
Another putdata() virtual function purpose is to print data those already stored in the class instance variables using cout abject form the output screen and endl is use to change the new line.
I hope you are understood this explanation.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Virtual Functions
You are viewing a single comment's thread. Return to all comments →
Firstly make the getdata() function is virtual function after that taking input from user using cin object and name, age are the class instance variable of the same class.(this-> it is a reference of the same class instance member variables. )
Another putdata() virtual function purpose is to print data those already stored in the class instance variables using cout abject form the output screen and endl is use to change the new line.
I hope you are understood this explanation.