CS 162 Lecture Notes - Lecture 14: Object Copying

31 views3 pages
CS 162 Lecture 14 Exam Answers and Explanations
Exam answers
o You can use assignment character with objects
o A struct is declaring the same as any other data type
Can be returned in a function
o Constructors in a class need to be public to be used
o Arrow operator dereferences a pointer and works as the dot operator in one
o File output can be formatted the same as cout
o A destructor is not allowed to have any parameters
o Encapsulation is the hiding of implementation details
The object does not encapsulate things, it has to do with the way the
class is set up
o In c++ data members in a class can be public or private
o A static member function does not need to be called by a specific object of the
class
o Constructors are called automatically
Cannot be called with dot operator
o In a shallow copy, pointers are not followed, just location stored
o Structs are found in interface files (.h)
o Header guards prevent multiple includes of an interface file
o <> means go look somewhere else
 ea look loall
o classes are default private and have functionality and structs are default public
ad do’t hae futioalit
o const means the function will not change the member variables
o do not need delete in a copy constructor
assumes that the object that we are copying into does not exist yet,
therefore there is nothing to delete
o constructor is automatically called when a class object is created
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

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

Related Questions