COM SCI 31 Lecture Notes - Lecture 17: Init, Undefined Behavior, Null Pointer

24 views6 pages
12 Jan 2017
School

Document Summary

Struct target public: // any part of the program can use init, move and replayhistory. Target(); // a constructor . no arguments, automatically called when an object is created bool move(char dir); void replayhistory() const; //only functions allowed to manipulate. // history can only have rs and ls. Target t; / automatically calls target fcn, initializes t. pos and t. history. // t. pos += 17; won"t compile! can"t change private member. // cout > c; if (! t2. move(c)) // if t2 doesn"t return true. good bc it tests the function move. Target* targets[100]; // 100 uninitialized pointers to targets int ntargets = 0; targets[ntargets] = new target; // tells os to make space for a new.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents