#include <iostream>
using namespace std;
class Person {
public:
string name; // mistakes -> char name();
int age; // mistakes -> int age();
};
class Student : public Person {
public:
void displayStudentInfo(string id) {
cout << "(" << name << "\", " << age << " ,\"" << id << "\")"; // in order to put double quotations please put \ then " so-> \" this is how it will work
}
};
int main() {
Student student;
student.name = "\"Deb";
student.age = 17;
student.displayStudentInfo("S12345");
return 0;
}
OUTPUT:
("Deb", 17 ,"S12345")
No comments:
Post a Comment