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
|
447 Discussions
|
Please Login in order to post a comment
It pushes you to think about polymorphism, inheritance, and how base class pointers interact with derived class objects. Playwin567
Is my approach or design following best practices? ` class Person{ string name; int age; public: virtual void getdata(){ cin>>name>>age;
};
class Professor: public Person{ int publications; static int cur_id; int id;
}; int Professor::cur_id = 0;
class Student: public Person{ int marks[6]; static int cur_id; int id;
}; int Student::cur_id = 0; `
Here is Virtual Functions problem solution in C++ - https://programmingoneonone.com/hackerrank-virtual-functions-solution-in-cpp.html