Chapter 7 map1

Chapter 7 map1 - designate who has access to class members...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Object Oriented Programing objects encapsulate data member variables object's attributes data hiding object hides data from outside code functions operate on data member functions some can be access by outside code accessor uses value from class member variable doesn't change the value use "get" in name mutator changes value of member variable stores value in member variable use "set" for this function type Where to deFne inside class declaration inline function used when function body is very short function prototype when the function body is too long EX: void setRadius (double); or outside class declaration How to deFne function header return type or void function name parameter list (can be empty) EX: void Circle::setRadius (double r) includes class name includes :: before function name after function type :: scope resolution operator :: used to tell compiler which class the function belongs to {statements to carry out the function} name conventtions constructor automatically called
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online