Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <utility>
- #include <string>
- using namespace std;
- class common{
- public:
- string real_race = "a";
- common(string real_race){
- this->real_race = std::move(real_race);
- }
- virtual void print(){
- cout << "Race: " << real_race << endl;
- }
- };
- class Bird : public common{
- public:
- string name, predator, edibility;
- Bird(string real_race, string name, string predator, string edibility) : common(real_race){
- this->real_race = std::move(real_race);
- this->name = std::move(name);
- this->predator = std::move(predator);
- this->edibility = std::move(edibility);
- }
- virtual void print(){
- cout << "~Bird~" << endl;
- cout << "Race: " << real_race << endl;
- cout << "Predator: " << name << endl;
- cout << "Edibility: " << edibility << endl << endl;
- }
- };
- class Bat : public common{
- public:
- string species, weight, feed, habitat;
- Bat(string real_race, string species, string weight, string feed, string habitat) :common(real_race){
- this->species = std::move(species);
- this->weight = std::move(weight);
- this->feed = std::move(feed);
- this->habitat = std::move(habitat);
- }
- virtual void print() {
- cout << "~Bat~" << endl;
- cout << "Race: " << real_race << endl;
- cout << "Species: " << species << endl;
- cout << "Weight: " << weight << endl << endl;
- cout << "What feeds on: " << feed << endl;
- cout << "Habitat" << habitat << endl << endl;
- }
- };
- class Pterodactyl : public common{
- public:
- string era;
- Pterodactyl(string real_race, string era) : common(real_race) {
- this->era = std::move(era);
- }
- virtual void print() {
- cout << "~Pterodactyl~" << endl;
- std::cout << "Race: " << real_race << endl;
- std::cout << "The era of life value: " << era << endl << endl;
- }
- };
- int main() {
- auto Bird_data = Bird("Sparrow", "No", "No", "Yes");
- Bird_data.print();
- auto Bat_data = Bat("1", "Winged", "22gr", "Insects", "Mountains, steppes");
- Bat_data.print();
- auto Pterodactyl_data = Pterodactyl("Ancient", "Mesozoic");
- Pterodactyl_data.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement