From aa035961b38b6f01090e6f6a2ee4c9b9fb5041e8 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 24 Sep 2010 19:09:22 +0000 Subject: add * and -> operators git-svn-id: svn+q:///qpdf/trunk@1029 71b93d88-0707-0410-a8cf-f5a4172ac649 --- libtests/pointer_holder.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libtests/pointer_holder.cc') diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index 173a8266..c255df5a 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -12,6 +12,7 @@ class Object Object(); ~Object(); void hello(); + void hello() const; private: static int next_id; @@ -38,8 +39,21 @@ Object::hello() std::cout << "calling Object::hello for " << this->id << std::endl; } +void +Object::hello() const +{ + std::cout << "calling Object::hello const for " << this->id << std::endl; +} + typedef PointerHolder ObjectHolder; +void callHello(ObjectHolder const& oh) +{ + oh.getPointer()->hello(); + oh->hello(); + (*oh).hello(); +} + int main(int argc, char* argv[]) { std::list ol1; @@ -74,6 +88,9 @@ int main(int argc, char* argv[]) } ol1.front().getPointer()->hello(); + ol1.front()->hello(); + (*ol1.front()).hello(); + callHello(ol1.front()); ol1.pop_front(); std::cout << "goodbye" << std::endl; return 0; -- cgit v1.2.3-54-g00ecf