#include<iostream>
#include<string>
using namespace std;

class DS
{
public:
	string name;
	int feet, inches;
	DS(string aName=" ", int aFeet=0,int aInches=0)
	{
              name=aName;
              feet=aFeet;
              inches=aInches;
    }            
};

//operator overload cannot pass a pointer, it has to be an object.
DS  operator+(DS  A, DS  B)
{
                int F,I;
                F=A.feet+B.feet;
                I=A.inches+B.inches;
                if(I>=12)
                {
                         F++;
                         I-=12;
                }
                DS totalobj("total", F, I);
                return totalobj; 
}
int main()
{
	DS *objPtr,*head;
	objPtr = new DS[2];  //dynamically allocate memory
	head=objPtr;
	objPtr->name="Kevin Alexander";
	objPtr->feet=6;
	objPtr->inches=2;
	objPtr++;
	objPtr->name="Antonio";
	objPtr->feet=5;
	objPtr->inches=11;
   // objPtr=head; 
    DS Aobj = *head;   //dereference
    DS Bobj = *objPtr; //dereference
    
    DS Cobj = Aobj + Bobj;  //call operator overload
    
    cout<<"The sum of their heights: ";
    cout<<Cobj.feet<<"'"<<Cobj.inches<<"\""<<endl;
    
    delete objPtr;  //release the memory of object. 
    delete head;
  
	system("pause");
	return 0;

}