=& operator overloading

Hi all,

how do I overload =& operators?

I want to be able to do this:
1
2
3
type1 a = 1;
type1 b;
b = &a;


type1 is a class, so what I basically would like to do is reference its content (ints, floats).

my compiler says that I only have the operator=(const type1&) available.

Best regards,
Yours3lf
There is no such operator. You can however overload unary & and assignment.
You need to overload the = operator and let it take a type1* as it's parameter.
Example:
1
2
3
4
5
class type1 {
 public:
  type1& operator=(type1*);
  ...
};
thanks both of you:)

I think I now get it.
Topic archived. No new replies allowed.