^ to index...

CSE 143 : 1 Feb 2000


Dynamic memory and classes

class Vector { public: Vector(); Vector(Vector& other); Vector& operator=(Vector& other); ~Vector(); // ... }; foo(Vector a, Vector& b, Vector* c); // arbitrary function

Assuming this Vector dynamically resizes itself (somehow), and that all methods are implemented correctly, what do each of the following do? Which lines invoke the no-argument constructor, copy constructor, destructor, and overloaded assignment operator? Which ones are legal and illegal? Why? Assume the statements are executed in order.


Keunwoo Lee
Last modified: Mon Jan 31 21:07:53 PST 2000