Inheritance
Inheritance
// INHERITANCE
// question no.1
#include <iostream>
#include <string>
class Student {
private:
string name;
int age;
string address;
public:
name = newName;
age = newAge;
name = newName;
age = newAge;
address = newAddress;
void printInfo() {
};
int main() {
Student students[numStudents];
students[i].printInfo();
return 0;
// question no.2
#include <iostream>
class Degree {
public:
cout << "\nUndergraduate: ";
undergraduate.getDegree();
postgraduate.getDegree();
return 0;
// question no.3
#include <iostream>
class Base {
protected:
int i;
public:
void printNum() {
};
private:
int j;
public:
void printNum() {
}
};
int main() {
obj.printNum();
obj.Base::printNum();
return 0;