Question: I have the application where user can erase image.

So if user touches some px of the image, alfa of these pixels should become lower.

For instance, if I touched (0,0) pixel of the image one time, (0,0) px opacity should become 0.9. If I touched that px 10 times I shouldn't see image at point (0,0).

What is the best approach to implement that?

Answer: 
You need to *dereference* the pointer, just like you did above.

```
cout << mainVector[1]->name;

```

or 

```
cout << (*(mainVector[1])).name;

```

Oh, and ForEveR got it right, vector indices start at 0. To get first element, you can also use `mainVector.front()`.

However, you probably don't want to use pointers at all. If you are sure you do, use `boost::ptr_vector` or a vector of `std` smart pointers. Right now this code has a **memory leak**.
From your code, you should be able to do:

```
cout << mainVector[0]->name << endl;

```