...
1// Copyright 2011 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5class Callback {
6public:
7 virtual ~Callback() { }
8 virtual std::string run() { return "Callback::run"; }
9};
10
11class Caller {
12private:
13 Callback *callback_;
14public:
15 Caller(): callback_(0) { }
16 ~Caller() { delCallback(); }
17 void delCallback() { delete callback_; callback_ = 0; }
18 void setCallback(Callback *cb) { delCallback(); callback_ = cb; }
19 std::string call();
20};
View as plain text