Course Solutions Uncategorized (Solved) : 11 Write Class Vec Message1 Following Declaration Class Vecmessage1 Public Vecmessage1 Vec Q30447641 . . . .

(Solved) : 11 Write Class Vec Message1 Following Declaration Class Vecmessage1 Public Vecmessage1 Vec Q30447641 . . . .

 

1.1

Write a class Vec Message1 with the following declaration.

class Vec_Message1 {

public:

Vec_Message1();

Vec_Message1(int n);

Vec_Message1(int n, const Message1 &a);

Vec_Message1(const Vec_Message1 &orig);

Vec_Message1& operator= (const Vec_Message1 &rhs);

~Vec_Message1();

int capacity() const;

int size() const;

Message1 front() const;

Message1 back() const;

void clear();

void pop_back();

void push_back(const Message1 &a);

Message1& at(int n);

private:

void allocate();

void release();

int _capacity;

int _size;

Message1 * _vec;

};

1.2 allocate() and release()

•Examine the code of the method allocate() in the class Vec intcarefully.

• Edit allocate() to allocate memory of the correct datatype.

• Explain why no changes are required in the function body ofrelease().

1.3 Constructors, copy, assign, destroy

• Explain why no changes are required in the function bodies forany of the constructors, copy, assignment and destructor.

• We

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post