SHARE
TWEET

Hierarchy

a guest May 23rd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <iostream>
  5. #include <fstream>
  6. #include <string>
  7.  
  8.  
  9. using namespace std;
  10.  
  11. class Item {
  12. public:
  13.     string item;
  14.     Item(string i) {
  15.         this -> item = i;
  16.     }
  17.     virtual string getType() { return "Standard item."; }
  18.     virtual string build() = 0;
  19. };
  20.  
  21. class Mechanism : Item {
  22. public:
  23.    
  24.     string build() {
  25.         cout << "Builded" << endl;
  26.     }
  27.  
  28.  
  29. };
  30.  
  31. class Product : Mechanism {
  32. public:
  33.     string getType()  {
  34.         return "Product";
  35.     }
  36.     string build() {
  37.         cout << "Product builded" << endl;
  38.     }
  39. };
  40.  
  41. class Node : Mechanism {
  42. public:
  43.     string getType() {
  44.         return "Node";
  45.     }
  46. };
  47.  
  48. int main()  
  49. {  
  50.  
  51.     _getch();
  52.     return 0;
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top