Schedule‎ > ‎

Ex_9.2a_mystudent.cpp

#include <iostream>
using namespace std;

class Student {
  public:
    Student(string name, int ID,
            string hobby);  //Constructor
  private:
    string _name;
    int _ID; 
};

Student::Student(string name, int ID, string hobby)  {
  _name = name;
  _ID = ID;
}

int main() {
    Student student1("Ennio",  98765, "C++");
}
Comments