CS162 - Prepare for Midterm - PowerPoint PPT Presentation

About This Presentation
Title:

CS162 - Prepare for Midterm

Description:

to support a first, middle initial, and last name using structures. Change the class to ... What does it mean to 'dereference' a pointer variable? ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 10
Provided by: off95
Learn more at: http://web.cecs.pdx.edu
Category:
Tags: cs162 | does | mean | midterm | my | name | prepare | what

less

Transcript and Presenter's Notes

Title: CS162 - Prepare for Midterm


1
CS162 - Prepare for Midterm
  • Review for the Midterm
  • Programming Assignment Discussion
  • Questions?
  • Midterm is next time

2
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

3
CS162 - Review Questions
  • Given the following class
  • class name
  • public
  • name()
  • name(char s)
  • int assign(char s)
  • void display()
  • private
  • char str10

4
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

5
CS162 - Review Questions
  • Why are pointers useful?
  • What are pointers?
  • Why would we pass a pointer to a function by
    reference?
  • What does it mean to dereference a pointer
    variable?
  • What does it mean to deallocate dynamic memory?

6
CS162 - Review Questions
  • Show how youd 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

7
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

8
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-gtmember

9
CS162 - Midterm
  • Questions?
Write a Comment
User Comments (0)
About PowerShow.com