Advertisement
boyan16-z

Birds

May 17th, 2018
2,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <utility>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. class common{
  9. public:
  10.     string real_race = "a";
  11.     common(string real_race){
  12.         this->real_race = std::move(real_race);
  13.     }
  14.  
  15.     virtual void print(){
  16.         cout << "Race: " << real_race << endl;
  17.     }
  18. };
  19.  
  20. class Bird : public common{
  21. public:
  22.     string name, predator, edibility;
  23.  
  24.     Bird(string real_race, string name, string predator, string edibility) : common(real_race){
  25.         this->real_race = std::move(real_race);
  26.         this->name = std::move(name);
  27.         this->predator = std::move(predator);
  28.         this->edibility = std::move(edibility);
  29.     }
  30.  
  31.     virtual void print(){
  32.         cout << "~Bird~" << endl;
  33.         cout << "Race: " << real_race << endl;
  34.         cout << "Predator: " << name << endl;
  35.         cout << "Edibility: " << edibility << endl << endl;
  36.     }
  37. };
  38.  
  39. class Bat : public common{
  40. public:
  41.     string species, weight, feed, habitat;
  42.  
  43.     Bat(string real_race, string species, string weight, string feed, string habitat) :common(real_race){
  44.         this->species = std::move(species);
  45.         this->weight = std::move(weight);
  46.         this->feed = std::move(feed);
  47.         this->habitat = std::move(habitat);
  48.     }
  49.  
  50.     virtual void print() {
  51.         cout << "~Bat~" << endl;
  52.         cout << "Race: " << real_race << endl;
  53.         cout << "Species: " << species << endl;
  54.         cout << "Weight: " << weight << endl << endl;
  55.         cout << "What feeds on: " << feed << endl;
  56.         cout << "Habitat" << habitat << endl << endl;
  57.     }
  58. };
  59.  
  60. class Pterodactyl : public common{
  61. public:
  62.     string era;
  63.  
  64.     Pterodactyl(string real_race, string era) : common(real_race) {
  65.         this->era = std::move(era);
  66.     }
  67.  
  68.     virtual void print() {
  69.         cout << "~Pterodactyl~" << endl;
  70.         std::cout << "Race: " << real_race << endl;
  71.         std::cout << "The era of life value: " << era << endl << endl;
  72.     }
  73. };
  74.  
  75. int main() {
  76.     auto Bird_data = Bird("Sparrow", "No", "No", "Yes");
  77.     Bird_data.print();
  78.  
  79.     auto Bat_data = Bat("1", "Winged", "22gr", "Insects", "Mountains, steppes");
  80.     Bat_data.print();
  81.  
  82.     auto Pterodactyl_data = Pterodactyl("Ancient", "Mesozoic");
  83.     Pterodactyl_data.print();
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement