CS210 Lab: Introduction Debugging and Linked Lists
Prelab


Prelab Questions:

The following are some questions that you can answer prior to the lab. These questions are specific to C++.
  1. What is a pointer?


  2. How would you declare a pointer called pOpponent to a class called AI_Opponent?


  3. How would you construct a new instance of AI_Opponent and assign it to pOpponent?


  4. Assuming the two previous steps worked, and that AI_Opponent has public member function draw, how would you call that function on pOpponent?


  5. How do you indicate that a pointer is pointing to nothing? What is such a pointer called?


  6. What happens if you try to access the data of a pointer to nothing?


  7. Suppose AI_Opponent's draw function draws a representation of the opponent based on a color that is unique to each instance. What would happen if you called that function on an invalid pointer?

  8. How could you prevent this from happening?


  9. What should you do when a pointer is done pointing at something?


  10. How do you clean up memory that was allocated specifically for a pointer?



For Answers, click here
Back to the Introduction to Visual C++ Lab click here
CS Dept Home Page CS Dept Class Files CS210 Class Files

© Department of Computer Science, University of Regina.