Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Converted code from: https://cdn.discordapp.com/attachments/481680603100741662/487068501241102352/13290f74d57f4f33a1e67a7fe8b8117f.jpg
- */
- using namespace std;
- #include <iostream>
- #include <random>
- #include <vector>
- struct fork { virtual void Look() = 0; };
- struct orange : fork { virtual void Look() { cout << "orange" << endl; }; };
- struct watermelon : fork { virtual void Look() { cout << "watermelon" << endl; }; };
- struct cherry : fork { virtual void Look() { cout << "watermelon" << endl; }; };
- struct strawberry : fork { virtual void Look() { cout << "strawberry" << endl; }; };
- struct pineapple : fork { virtual void Look() { cout << "pineapple" << endl; }; };
- struct apple : fork { virtual void Look() { cout << "apple" << endl; }; };
- bool shades() { return false; }
- int main()
- {
- if (shades() == false)
- cout << "poo" << endl;
- vector<shared_ptr<fork>> curry = { make_shared<orange>(), make_shared<watermelon>(),
- make_shared<cherry>(), make_shared<pineapple>(), make_shared<apple>() };
- for (auto thing : curry)
- {
- thing->Look();
- }
- system("PAUSE");
- return std::rand();
- }
Add Comment
Please, Sign In to add comment