Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Opcja
- {
- public:
- virtual void wybierz()
- {
- cout<<"?";
- }
- char k;
- };
- class Pomoc: public Opcja
- {
- public:
- virtual void wybierz()
- {
- cout<<"Pomoc";
- }
- };
- class Autor: public Opcja
- {
- public:
- virtual void wybierz()
- {
- cout<<"Autor";
- }
- };
- int main()
- {
- Opcja *w[2];
- char k;
- cin>>k;
- w[0]=new Autor;
- w[0]->k='a';
- w[1]=new Pomoc;
- w[1]->k='p';
- for(int i=0; i<2; i++)
- {
- if(k==w[i]->k) w[i]->wybierz();
- }
- for (int i=0; i<2; i++)
- {
- delete w[i];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement