Topic-Midterm

Topic-Midterm - by reference • What does it mean to...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CS162 - Prepare for Midterm Review for the Midterm Programming Assignment Discussion Questions? Midterm is next time
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS162 - Topics The midterm will cover the following topics: function arguments --reference vs. value structures and arrays of structures classes: constructors, destructors, class interface versus class implementation, member functions, data members pointers: defining pointer variables, allocating and deallocating memory
Background image of page 2
CS162 - Review Questions Given the following class: class name { public: name(); name(char s[]); int assign(char s[]); void display(); private: char str[10]; };
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS162 - Review Questions Implement the code for: the constructors the display function the assign function Change this class to support a first, middle initial, and last name using structures Change the class to allocate the memory for str dynamically using new and pointers
Background image of page 4
CS162 - Review Questions Why are pointers useful? What are pointers? Why would we pass a pointer to a function
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 8
Background image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: by reference? • What does it mean to “dereference” a pointer variable? • What does it mean to “deallocate” dynamic memory? CS162 - Review Questions • Show how you’d pass a video structure to a function – by value – by reference – as an array of videos – as a pointer, by value – as a pointer, by reference CS162 - Review Questions • When do we need to dereference a pointer variable • Explain how it is possible to establish (set) the size of an array at run time • What is the purpose of a constructor? • What is the purpose of the destructor? • What is the difference between a class instance, a class member, and an object CS162 - Review Questions • Show how you would allocate an array of five characters dynamically • Show how you would deallocate such an array • What is the difference between *variable.member (*variable).member variable->member CS162 - Midterm Questions?...
View Full Document

{[ snackBarMessage ]}

Page1 / 9

Topic-Midterm - by reference • What does it mean to...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online