| | |
Dynamic class members?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2005
Posts: 15
Reputation:
Solved Threads: 0
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
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++.
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++.
I'm here to prove you wrong.
•
•
Join Date: Aug 2005
Posts: 15
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Pointers to class members - it just won't work. (C)
- Help with calling class members (C++)
- Stacks - balanced parentheses (C++)
- derived class (C)
- accessing private data members (C++)
Other Threads in the C++ Forum
- Previous Thread: Need help on homework
- Next Thread: Need a C/C++ project related to networks
| Thread Tools | Search this Thread |
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






