由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - class with a pointer member
相关主题
a c++ questionzero-sized array vs pointer
pointer to base class = new derived, what will happend??[合集] can one type cast reference in C++
Interview question: is the following code OK?pointer to class, which class?
Quick Q: data member class's dtor order请教个C++的问题
mem_fun_ref为什么必须引用?some C++ interview questions
Question about data member offset问个 C++到C的问题
听说pointer to member function只支持最多128个virtual functi问一个inheritance的初级问题
is size_t recommended for 64-bit windows porting?[合集] C++ private member question
相关话题的讨论汇总
话题: pi话题: int话题: class
进入Programming版参与讨论
1 (共1页)
q**p
发帖数: 147
1
class A{
public:
A(int* _pi,int _size):pi(_pi),size(_size){}
int* pi;
int size;
};
int a[] = {1,2,3};
A* ap = new A(a,3);
delete ap;
ap的pi指向了a的第一个元素,请问A的default dtor 会删除 a这个数组么?
X****r
发帖数: 3557
2
no

【在 q**p 的大作中提到】
: class A{
: public:
: A(int* _pi,int _size):pi(_pi),size(_size){}
: int* pi;
: int size;
: };
: int a[] = {1,2,3};
: A* ap = new A(a,3);
: delete ap;
: ap的pi指向了a的第一个元素,请问A的default dtor 会删除 a这个数组么?

b********e
发帖数: 58
3
no
1 (共1页)
进入Programming版参与讨论
相关主题
[合集] C++ private member questionmem_fun_ref为什么必须引用?
how much memory does it take to save the member function in a class ?Question about data member offset
请问C++小白问题听说pointer to member function只支持最多128个virtual functi
Why do I need to use "plain" pointer?is size_t recommended for 64-bit windows porting?
a c++ questionzero-sized array vs pointer
pointer to base class = new derived, what will happend??[合集] can one type cast reference in C++
Interview question: is the following code OK?pointer to class, which class?
Quick Q: data member class's dtor order请教个C++的问题
相关话题的讨论汇总
话题: pi话题: int话题: class