Create two classes DM and DB which store the value of distances. DM stores distance in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB by keeping following in mind. Use friendly function to carry out the addition. The object that stores the results may be a DM or DB object, Depending on the unit in which the results are required.
Q.) Create two classes DM and DB which store the value of distances. DM stores distance in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB by keeping following in mind. Use friendly function to carry out the addition. The object that stores the results may be a DM or DB object, Depending on the unit in which the results are required. #include <iostream> using namespace std; class DM; class DB { float feet, inches; public: void init() { cout << "Enter The Distance in Feet :"; cin >> feet; cout << "Enter the Distance in inches : "; cin >> inches; } void display() { cout << "After Addition : \n"; cout << "Feet : " << feet << " Inches : " << inches << endl; } friend DB add(DM, DB); }; class DM { float meter, centimeter; public: void init() { cout <...