blob: 02ff24848c5724665481aab3b0dd82279e1f8815 [file] [log] [blame]
Brian Silverman4e662aa2022-05-11 23:10:19 -07001// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9// This example shows Rust subclasses of C++ classes.
10// Here are the C++ classes which we're subclassing.
11
12#pragma once
13
14#include <string>
15#include <memory>
16
17class MessageProducer {
18public:
19 virtual std::string get_message() const = 0;
20 virtual ~MessageProducer() {};
21};
22
23class MessageDisplayer {
24public:
25 virtual void display_message(const std::string& message) const = 0;
26 virtual ~MessageDisplayer() {};
27};
28
29void register_cpp_thingies();
30void register_producer(const MessageProducer& producer);
31void register_displayer(const MessageDisplayer& displayer);
32
33void run_demo();