// definition of the class compsci Each compsci is a student // and also has a list of programming languages they know // #include #include #include "student.h" // compsci inherits from student class compsci: public student { private: char *langs; public: // default constructor intializes everything to nothing... // note that the base class student has the default // constructor called automatically compsci() { langs=NULL; } // constructor that accepts a name and average and langs // note that we have to explicitly call the // constuctor for class student or the default will be called! compsci( char *n, char *l, double x) : student(n,x) { langs = new char[ strlen(l)+1]; strcpy(langs,l); } // prints itself out, uses the student print method to do this. void print() { cout << "Computer Science Student" << endl; student::print(); // call base class print() cout << "Languages: " << langs << endl; } };