6. (A) Implement the concept of method overriding
| ||
class BaseClass | ||
{ | ||
public: | ||
void Display() | ||
{ | ||
cout<<"\n\tThis is Display() method of BaseClass"; | ||
} | ||
void Show() | ||
{ | ||
cout<<"\n\tThis is Show() method of BaseClass"; | ||
} | ||
}; | ||
class DerivedClass:public BaseClass | ||
{ | ||
public: | ||
void Display() | ||
{ | ||
cout<<"\n\tThis is Display() method of DerivedClass"; | ||
} | ||
}; | ||
void main() | ||
{ | ||
clrscr(); | ||
DerivedClass Dr; | ||
Dr.Display(); | ||
Dr.Show(); | ||
getch(); | ||
} |
6. (A) Implement the concept of method overriding
Reviewed by admin
on
December 23, 2019
Rating:
No comments: