So i have a class which is defined by:
class Interval{
public:
double upperLimit;
double lowerLimit;
double function[5];
Interval *interval;
};
At one point i declare two objects of the type Interval:
Interval interval;
Interval cInterval;
and i get two types of errors:
1) when i make an assignment like this:
cInterval.interval = &interval
I get an error : a value of type "Interval *" cannot be assigned to an entity of type "Interval *"
2) Also when i try to copy the objects:
interval = &cInterval
or
interval = cInterval
i get an error no operator "=" matches these operands -- operand types are: Interval = Interval
In first case both are pointer so i'm not sure why it's not working, in second case i've also tried to overload '=' operator but it still gave me this error (shouldn't be default '=' operator be implemented anyway ?).
Aucun commentaire:
Enregistrer un commentaire