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.

    Glib::RefPtr<Gdk::Pixbuf> refPixbuf = Gdk::Pixbuf::create_from_file(filename);
    int width = refPixbuf->get_width();

But unlike most smartpointers, you can't use the * operator to access the underlying instance.

    Glib::RefPtr<Gdk::Pixbuf> refPixbuf = Gdk::Pixbuf::create_from_file(filename);
    Gdk::Pixbuf& underlying = *refPixbuf; //Syntax error - will not compile.

Appendix A. The RefPtr smartpointer |  | Casting