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::Bitmap> refBitmap = Gdk::Bitmap::create(window,
    data, width, height);
    int depth = refBitmap->get_depth();

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

    Glib::RefPtr<Gdk::Bitmap> refBitmap = Gdk::Bitmap::create(window,
    data, width, height);
    Gdk::Bitmap* underlying = *refBitmap; //Syntax error - will not compile.

Appendix A. The RefPtr smartpointer |  | Casting