int main() { Person * p = new Student; Student * s = new Student; Student * gs = new GradStudent; Person * ps = new GradStudent; p->aboutMe(); s->aboutMe(); gs->aboutMe(); ps->aboutMe(); delete p; delete s; delete gs; delete ps; return 0; }
int main() { Person *p = new Student(); p->aboutMe(); p->addCourse("Math"); delete p; return 0; }
int main() { //Student *s = new Student(); Person *p = new Student(); //s->aboutMe(); p->aboutMe(); p->addCourse("Advance Operating System"); //delete s; delete p; cout << sum(4) << endl; cout << sum(1,2) << endl; int *ptr = new int; *ptr = 3; cout << ptr << endl; cout << *ptr << endl; int a = 7; int &b = a; b = 12; cout << a << endl; ofstream file; file.open("testFile.txt"); file << "This line will be written on the first line in the file.\n"; file << "This line will be written on the second line in the file."; file.close(); int lines; cout << "How many lines from end : "; cin >> lines; getLastKLines("4.4.cpp", lines); return 0; }