blob: bbf611846bbcc7c1a6c012da3671f62039be2b2f [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>
Brian Silverman4e662aa2022-05-11 23:10:19 -070015
16class MessageProducer {
17public:
18 virtual std::string get_message() const = 0;
19 virtual ~MessageProducer() {};
20};
21
22class MessageDisplayer {
23public:
24 virtual void display_message(const std::string& message) const = 0;
25 virtual ~MessageDisplayer() {};
26};
27
28void register_cpp_thingies();
29void register_producer(const MessageProducer& producer);
30void register_displayer(const MessageDisplayer& displayer);
31
32void run_demo();