Problem in calling an overloaded operator= from inside anotheroverloaded operator= in C++

A

Afshin

Hi everybody,

I am developing code for a scheduling problem in which I have a
class for products (called cProduct) which contains, among others, an
array of class cResource to represent the resources used to process
the product. For both classes (cProduct and cResource), I have defined
overloaded operator= ; with operator= for cResource being called from
inside the overloaded operator= defined for cProduct. The problem is
that in calling the internal operator= (from inside the opertor= for
class
cProduct) the value of rhs (being passed from internal call to
operator=) seems to get lost!.
I appreciate any hint or clue on how to fix this problem. Below is a
summary of
relevant classes and overloaded operator=:

class cResource{
public:
cResource(); //constructor
int x; //as a sample member variable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top