Код: Выделить всё
class foo
{
private:
int* abc;
public:
foo()
{ abc = new int(2); }
~foo()
{ delete abc; }
void func()
{ delete abc; }
};
< /code>
Теперь допустим, что основная функция определяется, как показано ниже: < /p>
int main(int argc, char** argv)
{
foo a;
a.func();
}
Подробнее здесь: https://stackoverflow.com/questions/142 ... member-fun
Мобильная версия