|
-
May 27th, 2002, 03:55 AM
#1
delete const object
class A {
public :
A();
~A();
int f();
};
class B {
public :
A* a;
B();
~B();
const A* getA();
};
void main(void) {
B b ;
const A* a = b.getA() ;
delete a;
}
I have found a solution, using a third class C, having the same interface of A and a menber A*. The destructor of this class doesn’t delete the pointer and I have changed the class B which return an pointer on a class C.
I just want to know if there is an other solutions.
Bruno.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|