Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- class Species {
- protected:
- std::string speciesName;
- public:
- int population = 1;
- void setSpecies(std::string str)
- {
- this->speciesName = str;
- }
- std::string getSpeciesName()
- {
- return this->speciesName;
- }
- };
- int main()
- {
- Species firstSpecies;
- Species secondSpecies;
- firstSpecies.setSpecies("Bird");
- secondSpecies.setSpecies("Ant");
- secondSpecies.population = 100;
- std::cout
- << "I have "
- << firstSpecies.getSpeciesName()
- << " = "
- << firstSpecies.population
- << " and "
- << secondSpecies.getSpeciesName()
- << " = "
- << secondSpecies.population
- << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement