Quote Originally Posted by Paul McKenzie View Post
Well as I stated previously, what you want is not just a couple of lines of code here and there. Writing C++ classes properly is an entire concept that needs to be learned.
Assignment operators and copy constructor:
Code:
BookInfo(const BookInfo& ); // copy constructor
BookInfo& operator=(const BookInfo& ); // assignment operator
Those are assignment operators and copy constructor for a class called BookInfo. Just for now, create these two functions, but do not implement them. Also, make them private in your template class. This would at least prevent copying and assigning. If you attempt to copy or assign, you will get a compiler or linker error.

If you did not implement these functions as stated above, then your program will just blow up as soon as you assign one vector to another, pass or return a vector by value, etc. That's why we declare these functions but do not implement them, so that the compiler will flag us down for any copy/assignment usage we may have inadvertantly done.

More issues with your code:
Code:
Class BookInfo
First, "class" is not spelled with a capital 'C'.

Second, it makes no sense creating a template class called "BookInfo". It should be called MyVector, or DynArray, or something that denotes the data structure.

Regards,

Paul McKenzie
Starting to understand it.. so to store the data, how should I write it?

thanks for the copy constructor and the assignment constructor.