Red - Chapter 4 exercises/test answers

Chapter 4 _Try This_ and self test answers.
Of course :wink: (okay, we totally can't).

My point was more that good use of RAII negates the need to think about cleanup in common cases - that is, accessing resources through a handle that cleans itself up when it (the handle), is out of scope. For example, the following C code causes a memory leak:

```c
MyBuffer* init_buffer() {
  MyBuffer* buffer = malloc( sizeof(*buffer) );
  /* initialise buffer */
  return buffer;
}

void do_something() {
  MyBuffer* buff = init_buffer();
} /* Oh no, buffer was never freed! */
```

But the following modern C++ code equivalent is memory-safe:

```c++
unique_ptr<MyBuffer> init_buffer() {
  unique_ptr<MyBuffer> buffer { new MyBuffer };
  // initialise buffer
  return buffer;
}

void do_something() {
  auto buff = init_buffer();
} /* buffer is freed automatically */
```

I guess I wish Java had some mechanism for scope-based deallocation for those cases when you have a clearly defined resource owner.