N
noobzillaking
If I have the following code:
struct Pencil
{
int Sharpness;
};
class random
{
public:
Pencil& GetPencil() const {return p;}
Pencil p;
};
Why doesn't this compile.... when.....
struct Pencil
{
int Sharpness;
};
class random
{
public:
Pencil& GetPencil() const {return *(Pencil*)&p;}
Pencil p;
};
Does compile.
Is there something weird about references that I don't know about?
struct Pencil
{
int Sharpness;
};
class random
{
public:
Pencil& GetPencil() const {return p;}
Pencil p;
};
Why doesn't this compile.... when.....
struct Pencil
{
int Sharpness;
};
class random
{
public:
Pencil& GetPencil() const {return *(Pencil*)&p;}
Pencil p;
};
Does compile.
Is there something weird about references that I don't know about?