// Init - initialize the student object public void Init(string sName, int nID) { this.sName = sName; this.nID = nID; courseInstance = null; }
CourseInstance _courseInstance; // Convention is optional. // Init - Initialize the student object. public void Init(string name, int id) { this._name = name; // With the naming convention, _name, this._id = id; // 'this' is no longer needed. _courseInstance = null; }
// Enroll - Enroll the current student in a course. public void Enroll(string courseID) { _courseInstance = new CourseInstance(); _courseInstance.Init(this, courseID); }
// Enroll - enroll the current student in a course public void Enroll(string sCourseID) { courseInstance = new CourseInstance(); courseInstance.Init(this, sCourseID); }
// Enroll -- Enroll the current student in a course. public void Enroll(string courseID) { _courseInstance = new CourseInstance(); _courseInstance.Init(this, courseID); // The explicit reference. }
// Init -- Initialize the student object. public void Init(string name, int id) { this._name = name; this._id = id; _courseInstance = null; }
// Enroll -- Enroll the current student in a course. public void Enroll(string courseID) { _courseInstance = new CourseInstance(); _courseInstance.Init(this, courseID); // Here’s the explicit reference. }