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;
- float average;
- public:
- Student () {
- cout << "empty constructor" << endl;
- }
- Student(string _name, string _surname, int _age, float _average) {
- name = _name;
- surname = _surname;
- age = _age;
- average = _average;
- cout << "with parameters" << endl;
- }
- Student(const Student & tmp) {
- name = tmp.name;
- surname = tmp.surname;
- age = tmp.age;
- average = tmp.average;
- cout << "copy constructor" << endl;
- }
- };
- int main()
- {
- Student s("Petar", "Petrovski", 23, 9.5);
- Student s2 = s;
- Student s3(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement