We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Classes
- Virtual Functions
- Discussions
Virtual Functions
Virtual Functions
Sort by
recency
|
448 Discussions
|
Please Login in order to post a comment
class Person { public: virtual void getdata() = 0; virtual void putdata() = 0;
};
class Professor : public Person {
private: int publications{}; static int prof_seq_id; int prof_cur_id{};
public: Professor() :prof_cur_id {prof_seq_id} { prof_seq_id++; }
void getdata() override { cin >> name; cin >> age; cin >> publications; }
void putdata() override { cout << name << " " << age << " " << publications << " " << prof_cur_id << endl; }
};
int Professor::prof_seq_id = 1;
class Student : public Person {
private: vector marks; int stud_cur_id {}; int sum; static int stud_seq_id;
};
int Student::stud_seq_id = 1;
class Person {
public: string name; int age;
};
class Professor: public Person {
int publication; static int cur_id;
};
class Student:public Person {
int marks[6]; static int cur_id;
};
int Professor::cur_id = 0; int Student::cur_id = 0;
class Person { public: string name; int age;
};
class Professor: public Person { int publication; static int cur_id;
};
class Student:public Person { int marks[6]; static int cur_id;
};
int Professor::cur_id = 0; int Student::cur_id = 0;