J
JKop
class Cow
{
public:
void EatGrass() const {}
};
class Brow
{
private:
Cow cow;
public:
operator Cow&()
{
return cow;
}
};
int main()
{
Brow k;
k.EatGrass();
}
Is there any way I can achieve the above, whereby a Brow is implicitly
converted to a Cow? Here would be another example:
class Blah
{
private:
double a;
public:
operator double&()
{
return a;
}
};
int main()
{
Blah jk;
jk = 52.0;
}
-JKop
{
public:
void EatGrass() const {}
};
class Brow
{
private:
Cow cow;
public:
operator Cow&()
{
return cow;
}
};
int main()
{
Brow k;
k.EatGrass();
}
Is there any way I can achieve the above, whereby a Brow is implicitly
converted to a Cow? Here would be another example:
class Blah
{
private:
double a;
public:
operator double&()
{
return a;
}
};
int main()
{
Blah jk;
jk = 52.0;
}
-JKop