I have this assignment from my book that wants me to create a class and have its member variables be dynamic. This is easy to do but I can't understand why I would want to, and don't see any advantages of having the members be dynamic. Personally I would create the class (or perhaps an array of class objects) dynamically.
The biggest problem with My C++ book is that the samples and examples are all very unrealistic to real life programming. If the only purpose of the assignment is to familiarize me with using the "new" and "delete" keywords then I have learned very little. Is there a C++ book that is advanced and close to the true programming that is done in the real world?
Randy

> Personally I would create the class (or perhaps an array of class objects) dynamically.
That's a different thing entirely. Let's say you have an array class that grows and shrinks dynamically. How would creating the class dynamically solve that problem? It wouldn't; you would need to create and maintain a dynamic member.

>Is there a C++ book
Accelerated C++ by Andrew Koenig and Barbara Moo. It's by far the best book for learning C++.

Thanks for your reply.
Yes a dynamic array that grows or shrinks would not be solved with the array of objects that I proposed. I always wondered how this problem was dealt with. I just don't have a good understanding of the use of dynamic members and will do some research on the internet on this.
I looked at the book you suggested and may order it. It seems like it has some material that my books don't have. One can never have too many programming books.
Thanks
Randy

This article has been dead for over six months. Start a new discussion instead.