Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <clocale>
- #include <string>
- #include <clocale>
- using namespace std;
- class dog {
- friend class person;
- private:
- int health = 100;
- };
- class person {
- public:
- void damage(dog d) {
- d.health -= 20;
- }
- };
- int main(int argc, const char * argv[]) {
- person vasya;
- dog bobik;
- cout << vasya.damage(bobik);
- return 0;
- }
Add Comment
Please, Sign In to add comment