siplasplas
classes.hpp
1 #ifndef SIPLASPLAS_EXAMPLES_TYPEERASURE_CLASSES_HPP
2 #define SIPLASPLAS_EXAMPLES_TYPEERASURE_CLASSES_HPP
3 
4 #include <string>
5 #include <ostream>
6 
7 class Foo
8 {
9 public:
10  Foo(const std::string str) :
11  str{str}
12  {}
13 
14  void append(const std::string& tail)
15  {
16  str += tail;
17  }
18 
19  std::string str = "hello";
20 };
21 
22 class Bar
23 {
24 public:
25  Bar(int i) :
26  i{i}
27  {}
28 
29  void add(int number)
30  {
31  i += number;
32  }
33 
34  std::string toString() const
35  {
36  return std::to_string(i);
37  }
38 
39  int i = 0;
40 };
41 
42 class Quux : public Foo, public Bar
43 {
44 public:
45  Quux(const std::string& str, int i) :
46  Foo{str},
47  Bar{i}
48  {}
49 };
50 
51 
52 #include <reflection/examples/typeerasure/classes.hpp>
53 
54 #endif // SIPLASPLAS_EXAMPLES_TYPEERASURE_CLASSES_HPP
Definition: foobar.hpp:7
Definition: foobar.hpp:19
Definition: classes.hpp:42