47 Labrador(
const std::string& _name,
int _excitement = 9001)
55 std::string
bark()
const {
return Dog::bark() +
" and runs in circles"; }
61 std::string
purr()
const {
return "mrowr"; }
67 std::string
purr()
const {
return "mrrrRRRRRR"; }
72 std::vector<std::unique_ptr<Animal>> ret;
73 ret.emplace_back(
new Labrador(
"Fido", 15000));
80 ret.emplace_back(
new Chihuahua(
"Hertzl"));
82 ret.emplace_back(
new Panther(
"Leo"));
114 template <
typename itype>
117 static const void *
get(
const itype *src,
const std::type_info*&
type)
123 py::class_<Animal>(
m,
"Animal")
125 py::class_<Dog, Animal>(
m,
"Dog")
126 .def(py::init<std::string>())
129 py::class_<Labrador, Dog>(
m,
"Labrador")
130 .def(py::init<std::string, int>(),
"name"_a,
"excitement"_a = 9001)
132 py::class_<Chihuahua, Dog>(
m,
"Chihuahua")
133 .def(py::init<std::string>())
135 py::class_<Cat, Animal>(
m,
"Cat")
136 .def(py::init<std::string>())
138 py::class_<Panther, Cat>(
m,
"Panther")
139 .def(py::init<std::string>())