Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class student {
- private:
- string name, surname;
- int age;
- public:
- student(string _name = "", string _surname = "", int _age = 0) {
- name = _name;
- surname = _surname;
- age = _age;
- }
- friend void check_age(student S);
- friend class CS;
- };
- void check_age(student s) {
- if(s.age > 25) {
- cout << "YES " << s.name << " " << s.surname << endl;
- }
- else {
- cout << "NO" << endl;
- }
- }
- class CS {
- private:
- int x, y;
- public:
- CS(int _x, int _y) {
- x = _x;
- y = _y;
- }
- void print(student s) {
- cout << s.name << " " << s.surname << " " <<s.age << endl;
- cout << x << " " << y << endl;
- }
- };
- int main() {
- student s("a", "b", 30);
- CS c(5, 5);
- c.print(s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement