<iostream>
using namespace std;
class student
{
:
roll;
:
getnumber(a)
{
roll=a;
}
putnumber()
{
std::cout << "roll number" << roll << "\n";
}
};
class test: student
{
:
part1,part2;
:
getmarks( x, y)
{
part1=x;
part2=y;
}
void putmarks()
{
std::cout << "marks obtain:" << "\n" << "part1=" << part1 << "\n" << "part2="<< part2 << "\n";
}
};
class sports
{
:
score;
:
getscore(float s)
{
score=s;
}
putscore()
{
std::cout << "sports wt:" << score << "\n\n";
}
};
class result: test, sports
{
total;
:
display();
};
result::display()
{
total=part1+part2+score;
putnumber();
putmarks();
putscore();
cout << "total score :" << total << "\n";
}
main()
{
result student1;
student1.getnumber(1234);
student1.getmarks(27.5,33.0);
student1.getscore(6.0);
student1.display();
0;
}
|