Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- class student
- {
- public:
- int course;
- int age;
- student()
- {
- course = 1;
- age = 18;
- }
- student(int course, int age)
- {
- course = course;
- age = age;
- }
- student(const student &obj)
- {
- course = obj.course;
- age = obj.age;
- }
- ~student()
- {
- std::cout<<"\nДеcтруктор сработал!\n";
- }
- int getAge(){
- return age;
- }
- void setAge(int age){
- age = age;
- }
- };
- int main() {
- student s1;
- student s2;
- s1(2, 20);
- s2(s1);
- s2.getAge;
- s1.setAge(15);
- std::cout<<s1.getAge;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement