Dereferencing
| Appendix A. The RefPtr smartpointer |

## Dereferencing

You can dereference a smartpointer with the -> operator, to call the methods of the underlying instance, just like a normal pointer.

    auto refPixbuf = Gdk::Pixbuf::create_from_file(filename);
    auto width = refPixbuf->get_width();

You can also use the * operator and the `get()` method to access the underlying instance, but it's usually a bad idea to do so. Unless you are careful, you can end up with a pointer or a reference which is not included in the reference count.

    auto refPixbuf = Gdk::Pixbuf::create_from_file(filename);
    auto& underlying = *refPixbuf; // Possible, but not recommended

Appendix A. The RefPtr smartpointer |  | Casting