c++ hybrid inheritance Example

c++ hybrid inheritance Example | C++ Mark-list Example using hybrid inheritance | Calculations using hybrid inheritance in C++

#include
#include
class student
{
protected:
int roll_no;
public:
void getdata(int a)
{
roll_no=a;
}
void putdata(void)
{
cout<<"\n roll_number: "< }
};

class test:public student
{
protected:
float part1,part2;
public:
void get_mark(float p,float q)
{
part1=p;
part2=q;
}
void put_mark(void)
{
cout<<"\n marks obtained ";
cout<<"\n mark1: "< cout<<"\n mark2: "< }
};
class sport
{
protected:
float scores;
public:
void get_scores(float s)
{
scores=s;
}
void put_scores(void)
{
cout<<"\n point: "< }
};
class result:public test,public sport
{
private:
float total;
public:
void display()
{
total=part1+part2+scores;
put_mark();
putdata();
cout<<"\n total is: "< }
};

void main()
{
clrscr();
result r;
r.getdata(31);
r.get_mark(50,50);
r.get_scores(50);
r.display();
getch();
}



Related Links :

No comments:

Post a Comment


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!