Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AnimalClass.h"
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main() {
- lmao::AnimalClass bleh();
- bleh.eat();
- bleh.walk();
- return 0;
- }
- #define ANIMALCLASS_H
- #ifndef ANIMALCLASS_H
- namespace lmao
- {
- class AnimalClass
- {
- public:
- AnimalClass();
- void checkEnergy();
- void eat();
- void walkAround();
- int energyLevel;
- };
- }
- #endif
- #include "AnimalClass.h"
- #include <iostream>
- namespace lmao
- {
- AnimalClass::AnimalClass()
- :energyLevel(0)
- {
- std::cout << "Animal created" << std::endl;
- }
- void AnimalClass::eat()
- {
- energyLevel += 5;
- std::cout << "Your animal just ate" << std::endl;
- }
- void AnimalClass::walkAround()
- {
- energyLevel -= 3;
- std::cout <<"Your animal just walked around and consumed some energy" <<std::endl;
- }
- void AnimalClass::checkEnergy()
- {
- std::cout << "You have " << energyLevel << " energy" << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement