#include<iostream.h>
#include<conio.h>
#include<string.h>
class ptr
{
char name[30];
int roll;
float age;
public:
ptr(char *a,float p,int n)
{
strcpy(name,a);
roll=n;
age=p;
}
ptr &ptr ::sd(ptr &x)
{
if(x.age>=age)
return x;
else
return *this;
}
void display()
{
cout<<"\nname= "<<name<<"\nage= "<<age<<"\nroll= "<<roll;
}
};
void main()
{
clrscr();
ptr p("arjun",2.3,4),p1("asd",3.4,2),p2("qwe",1.2,5);
ptr p3=p.sd(p2);
cout<<"\nthe senior person is";
p3.display();
p3=p.sd(p1);
cout<<"\nthe senior person is";
p3.display();
getch();
}