CSCI 103L Lecture 16: Lecture 16
Document Summary
If its private, only functions inside the class can call or access them. If it"s public you can call it anywhere. Use public: , or private: before de nitions: constructors, destructors. Constructor is a function of the same name as the class itself, it initializes the variable with some default values every time you create an object. I. e. whenever you make a deck set the top index to 0 and make all 52 cards. After doing this you can use variables and functions from other places in the class: calling member functions. Class pointers: can declare pointers to class types, use ->" operator to access member functions or data. Ex: d1 = new deck, d1->shuf e(), multiple constructors. Use if you have different inputs, or no inputs: id student() and student(string name, just a name doesn"t make a function unique, its name and the arguments that it takes make it unique.