Description: Now the class has been better achieved, and the user is easy to use.
However, the new issue came out again.
The dynamic array can store double types of data. Imagine, another user would like to use this dynamic array, but his handling of the data is int type, how do?
Of course, you can write a dynamic array of type int-based class, you find that most of the code have not changed, simply type int can become double.
If another user needs to be addressed is the float type, there is the user dealing with the char type .... How to do?
This disadvantage is clear:
similar code for these classes, code redundancy
When the right to modify this class, all of these classes should also change, is not conducive to code maintenance
Any other way to solve this problem? That is, if the variable can "type" also as a "variable", not to the information? This can not be solved in C, but in C++, there is a new mechanism template, you can solve these problems.
To Search:
File list (Check if you may need any files):
DArray-Template-better\DynamicArray.dsw
......................\DynamicArray.ncb
......................\DynamicArray.plg
......................\DynamicArray.dsp
......................\.ebug\vc60.idb
......................\.....\vc60.pdb
......................\.....\DynamicArray.exe
......................\.....\DynamicArray.pdb
......................\.....\main.obj
......................\.....\DynamicArray.pch
......................\.....\DArray.obj
......................\.....\DynamicArray.ilk
......................\DArray.cpp
......................\main.cpp
......................\DArray.h
......................\DynamicArray.opt
......................\Debug
DArray-Template-better