Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
496 B
1
Indexable
Never
#include<iostream>
using namespace std;
class base
{
	public:
		void disp()
		{
			cout<<"\n base class display";
		}
		virtual void show()
		{
			cout<<"\nshow base";
		}
};
class derived:public base
{
	public: 
	void disp ()
	{
		cout<<"\n derived class display";
	}
	void show()
	{
		cout<<"\n show derived";
	}
};
int main()
{
	base b;
	derived d;
	base*bptr;
	bptr=&b;
	bptr->disp();
	bptr->show();
	bptr=&d;
	bptr->disp();
	bptr->show();
	return 0;
}