Assignment 6 – Object Oriented Programming
1 Managing Dynamic Arrays
Managing dynamically sized arrays can be a pain while dealing with memory on the heap. Memory
leaks, dangling pointers, etc can lead to invalid memory accesses/segmentation faults that halt your
program abruptly. Your task is to design a DataVector class that encapsulates the implementation
of a dynamically sized double array. The interface should be such that the users of your class should
not be exposed to the underlying implementation details such as memory allocation (new), release
(delete), resize, etc. Your DataVector class must have the following public interface. The difficulty
levels are marked as L1, L2 and L3, going from easy to hard.
1. DataVector ( ) ; //L2
This is the default constructor with no parameters. By default, this allocates space for a
double array of size 10 and assigns a default value of 0 to each of them.
View original post 1 706 mots de plus