Dynamic class members?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2005
Posts: 15
Reputation: shortLived is an unknown quantity at this point 
Solved Threads: 0
shortLived shortLived is offline Offline
Newbie Poster

Dynamic class members?

 
0
  #1
Feb 17th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,779
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 744
Team Colleague
Narue's Avatar
Narue Narue is online now Online
Code Goddess

Re: Dynamic class members?

 
0
  #2
Feb 17th, 2006
> 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++.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15
Reputation: shortLived is an unknown quantity at this point 
Solved Threads: 0
shortLived shortLived is offline Offline
Newbie Poster

Re: Dynamic class members?

 
0
  #3
Feb 17th, 2006
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC