//object io #includeclass person { protected: char name[40]; int age; public: void getdata(void) { cout<<"\nEnter name: ";cin>>name; cout<<"\nEnter age: ";cin>>age; } };//end of class void main(void) { person pers; pers.getdata(); ofstream outfile("person.dat"); //create ofstream object outfile.write((char *)&pers,sizeof(pers)); }