compile following code is OK:
<code>
class MyClass
{
public:
int i;
};
void f(MyClass *& mc) {;}
int main()
{
f(new MyClass);
return 0;
}
</code>
but the following is not OK, why?
<code>
class MyClass
{
public:
int i;
};
void f(MyClass *& mc) {;}
int main()
{
MyClass m;
f(&m);
return 0;
}
</code>
<code>
class MyClass
{
public:
int i;
};
void f(MyClass *& mc) {;}
int main()
{
f(new MyClass);
return 0;
}
</code>
but the following is not OK, why?
<code>
class MyClass
{
public:
int i;
};
void f(MyClass *& mc) {;}
int main()
{
MyClass m;
f(&m);
return 0;
}
</code>