Show on the console the sum of all non-inherited data


1. show on the console the sum of all non-inherited data members of every instance in the program by Display() function.

2. the sum function needs to be a class method and having the same name for different classes, therefore only one external Display() fucntion is required

3. this Display() fucntion needs to be defined externally as a global function, void Display(Base &), that takes any instance of Base class or derived from Base class.

4. Should the sum can not be obtained, explain the reason in the comment.

Attachment:- program.txt

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Show on the console the sum of all non-inherited data
Reference No:- TGS01090235

Expected delivery within 24 Hours