EECS 280 Lecture Notes - Lecture 9: Function Overloading

29 views6 pages

Document Summary

Public means members are accessible from outside the class just like members of a struct. The default is private, meaning it can only be accessed by other members. Members can be more than just data items. A this pointer is automatically passed by the compiler; it is optional to add it. From outside the scope, we can access member functions using the dot operator. In memory, we get storage for each member in the class, just like a struct, but not for the functions. A constructor is a member function that has the same name as the class; it runs automatically when a new object is created. It is typically used to initialize member variables. Function overloading is when two different functions with the same name have different signatures. Since the compiler know the argument types, it can select the correct constructor when a new object is created. Constructors run in the order that the objects appear in memory.

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