Described in general terms the implementation of the vector


Question:  Described in general terms the implementation of the vector data type. Complete the implementation of the vector by providing definitions for the subsequent operations:

- A default constructor, which should create a buffer with capacity 5 and size 0.

- A constructor that takes an integer argument, and creates a buffer with the given size and capacity.

- A member function set_capacity(int), which changes the capacity to the indicated limit, copying elements from the current buffer. If the new capacity is larger than the current size, the size remains unchanged; otherwise the size is made the same as the new capacity.

- The operation at, which returns the element at the given location in the buffer.

- The operation push_back, which adds the element to the end of the buffer, increasing the size, and invoking set_capacity to increase the capacity of the buffer if essential.... 

Solve this question in details and provide examples to support your rationale.

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Described in general terms the implementation of the vector
Reference No:- TGS0957037

Expected delivery within 24 Hours