This is my second homework but is too hard to me, a lot of things i cannot understand. At Least help me finish two part, thanks a lots :D
#include <iostream>
using namespace std;
class int_array_cell
{
private:
int _counter;
int * _memory;
};
counter_ptr b("b", new int[10]); <- one b here
// stdout output: int_array_cell is allocated
// stdout output: counter_ptr b is assigned to an int_array_cell: counter 1
{
b = new int[100]; why got another b ??
// stdout output: int_array_cell counter 0: deleted
// stdout output: int_array_cell is allocated
// stdout output: counter_ptr b is assigned to an int_array_cell: counter 1
counter_ptr a("a"); two a?
// stdout output: counter_ptr a is not assigned to an int_array_cell
a = b;
// stdout output: int_array_cell counter is increased: counter 2 <- cannot get it
// stdout output: counter_ptr a is assigned to an int_array_cell: counter 2
}
// a leaves it scope:
// stdout output: counter_ptr a is deleted
// stdout output: int_array_cell counter is decreased: counter 1
what exactly is the assignment wanting you to do, and what exactly do you not understand?
all I see are requests for output statements (???) which does not seem correct.