CSCI 103L Lecture 16: Lecture 16

27 views2 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents