ENGTECH 1PR3 Lecture Notes - Lecture 1: Member Variable
Document Summary
Classes / basic oop lesson 1 string m_studentname = " "; // "m_ is" for member variables so any varibale insied. // so it makes sense sense to pass int m_studentid = 0; // its to avoid confuion bool m_enrolled = false; //private mean youu could not access those varibales from outside. // getters, accessor, gets value string getstudentname() {return m_studentname; } int getstudentid() { return m_studentid; } bool getenrolled() { return m_enrolled; } student(string studentname, int studentid); // constructor 3. // function with the same name as the class is the constructor void setstudentid(int studentid) { m_studentid = studentid; } void setenrolled(bool enrolled) { m_enrolled = enrolled; } // should initialize all member void setstudentname(string studentname){m_studentname = studentname;} // inline. // specifies a student name which is going to be. //student id is m_studentname = studentname; // initilaize member varibale with the value passed m_studentid = 10; void enrollstudent(); m_studentname = "default "; m_studentid =9999;