K
key9
Hi All
simple question:
1.====================================
{
int* p_1 = new int();
};
//will p1 leak?
2.====================================
class MyClass
{
public:
MyClass(){
p_2 = new int();
}
private:
int* p_2;
};
MyClass* mc_ = new MyClass();
delete mc_;
//will p_2 leak?
3.====================================
int* p_3 = new int();
{
int& r_1 = *p_3
};
//will p_3 hang?
4.====================================
I always confuse on these "will hang,will not hang...,will leak ,will not
leak"
, any knack?
thank you very much.
key9
simple question:
1.====================================
{
int* p_1 = new int();
};
//will p1 leak?
2.====================================
class MyClass
{
public:
MyClass(){
p_2 = new int();
}
private:
int* p_2;
};
MyClass* mc_ = new MyClass();
delete mc_;
//will p_2 leak?
3.====================================
int* p_3 = new int();
{
int& r_1 = *p_3
};
//will p_3 hang?
4.====================================
I always confuse on these "will hang,will not hang...,will leak ,will not
leak"
, any knack?
thank you very much.
key9