0

I haven't been able to find anything regarding setting a primitive data type equal to an object in c++, so I'm not sure if it is possible. Consider this code:

class FloatingPoint {
    private:
        float a;
    public:
        FloatingPoint(float b): a(b) {};
};
int main(){
     float num;
     FloatingPoint fPoint = new FloatingPoint(5.5);
     num = fPoint; //num should be set equal to 5.5

     return 0;
};

Is there some operator overloading that allows this?
(I am using this simple code for the sake of example, I understand that doing this sort of assignment is pointless)

Kelly Flet
  • 514
  • 2
  • 5
  • 23

0 Answers0