Idea Solution CS304View more random threads:
- MTH302 Business Mathematics & Statistics Assignment 2
- CS301 Data Structures Assignment No. 1 Solution and...
- HRM627 Human Resource Development GDB Solution 22nd...
- MGT613 Production/Operations Management Solution May 17,2010
- cs604 operating system assignment
- MGT502 Assignment 2 Idea Solution June 2010
- CS607-Artificial Intelligence Assignments No 2 (Graded)...
- CS601 Data Communication Assignment No. 2 Semester Fall 2012
- PSC201 International Relations Assignment No.1 Fall...
- MGT602 Entrepreneurship Assignment No 2 Solutions and...
Code:#include<iostream.h> #include<conio.c> //Employee class definition class Employee { public: Employee(){} //pure virtual method virtual void DisplayName()=0; }; //Salaried Employee class definition class SalariedEmployee:public Employee { public: SalariedEmployee(){} //overriden DisplayName virtual void DisplayName(){ cout<<"This is Salaried Employee"<<endl;} }; //Commission Employee class definition class CommissionEmployee:public Employee { public: CommissionEmployee(){} //overriden displayName virtual void DisplayName(){ cout<<"This is Commission Employee"<<endl;} }; void main() { //pointer to Employee declaration Employee *obj; //polymorphically call of DisplayName of Salaried Employee obj = new SalariedEmployee(); obj->DisplayName(); //Polymorphically call of DisplayName of Commission Employee obj= new CommissionEmployee(); obj->DisplayName(); getch(); }
Sponsored Links
:o:o--------------------------------------------------------------------------------------:o:o
[B]The more knowledge you have, the greater will be your fear of Allah.[/B]
Please Join My [B]Group Vuhelp[/B][B], Birthday Wishing, Daily Hadees[/B] [CODE][B]http://vuhelp.net/groups/vuhelp.html[/B]
[B]http://vuhelp.net/groups/birthday-wishing.html[/B]
[B]http://vuhelp.net/groups/daily-hadees.html[/B][/CODE]
[CENTER][B][COLOR="Red"][SIZE="4"]Email: [email]viki@vuhelp.net[/email][/SIZE][/COLOR][/B][/CENTER]
There are currently 1 users browsing this thread. (0 members and 1 guests)