Page 225 - DCAP404 _Object Oriented Programming
P. 225
Object-oriented Programming
Notes }
void student:: display ()
{
cout<< “the student’s roll number is “<<rollno<<“and name is”
<<name;
cout<< end1;
}
void academic:: getdata ( )
{
cout << “enter stream of a student? \n”;
cin>> stream;
}
void academic:: display 0
{
cout<< “students stream \n”;
cout<< stream << end1;
}
void main ()
{
student *ptr;
academic obj;
ptr = &obj;
ptr->getdata ( );
ptr->dlsplay ( );
getche ( )
}
output
enter stream of a student?
Btech
students stream
Btech
Self Assessment
Fill in the blanks:
1. The return type of an …………………………. virtual function may differ from the return
type of the overridden virtual function.
218 LOVELY PROFESSIONAL UNIVERSITY