|
-
June 6th, 2009, 11:46 PM
#12
Re: multiple instances of a class
 Originally Posted by sgiri1981
Thanks for your comments. I tried a few approaches and realized that I cant do this because
1. I dont want to construct this second object
2. The '=' operator in this object was not working (it gives some message, which reads something like "cannot access private methods"). Much of this class in inherited and I m not sure how operator overloading works across multiple hierarchies. I saw an easy way out with pointers (and some earlier posts recommend excessive use of pointers in C++, esp. to support polymorphism)
Thanks again,
sgiri
Ah, I think I can quickly explain something about number 2 there. The copy constructor and overloaded '=' operator are declared in the private section of the class, which means you can't use them the normal way they'd be used. I assume the code was made that way for a reason, of course, but just trying to pass on some knowledge.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|