I have done this :
having the class and the main fuction on the same cpp file, but how can I use 2 different files one for the class and one for the tester file(the main)???Code:#include<iostream> #include<string> class student { private: int score; string surname; public: student(string asurname, int ascore); ~student(); string getSurname(); int getScore(); }; student::student(string asurname, int ascore) { surname = asurname; score = ascore; } student::~student() { } string student::getSurname() { return surname; } int student::getScore() { return score; } using namespace std; int main() { student Mike("Senikoglou", 20); cout << Mike.getSurname(); cout << Mike.getScore(); return 0; }



LinkBack URL
About LinkBacks



