Lines Matching refs:Dog
13 to override from within Python (we'll focus on the class ``Animal``; ``Dog`` is
25 class Dog : public Animal {
52 py::class_<Dog, Animal>(m, "Dog")
102 py::class_<Dog, Animal>(m, "Dog")
124 extend ``Animal``, but not ``Dog``: see :ref:`virtual_and_inheritance` for the
134 >>> d = Dog()
160 class Dachshund(Dog):
162 Dog.__init__(self) # Without this, a TypeError is raised.
216 python classes. For example, suppose we extend the above ``Animal``/``Dog``
226 class Dog : public Animal {
239 inherit properly from ``Dog``, we also need a trampoline class for ``Dog`` that
241 methods inherited from ``Animal`` (even though ``Dog`` doesn't directly
252 class PyDog : public Dog {
254 using Dog::Dog; // Inherit constructors
255 std::string go(int n_times) override { PYBIND11_OVERRIDE(std::string, Dog, go, n_times); }
256 std::string name() override { PYBIND11_OVERRIDE(std::string, Dog, name, ); }
257 std::string bark() override { PYBIND11_OVERRIDE(std::string, Dog, bark, ); }
273 class Husky : public Dog {};
295 template <class DogBase = Dog> class PyDog : public PyAnimal<DogBase> {
314 py::class_<Dog, Animal, PyDog<>> dog(m, "Dog");
315 py::class_<Husky, Dog, PyDog<Husky>> husky(m, "Husky");
323 can now create a python class that inherits from ``Dog``:
327 class ShihTzu(Dog):
960 py::class<Dog, pets::Pet>(m, "Dog")
1027 >>> mycat, mydog = cats.Cat("Fluffy"), dogs.Dog("Rover")
1168 wrapping a Dog, if Pet has virtual methods and pybind11 knows about
1169 Dog and this Pet is in fact a Dog. Sometimes, you might want to
1178 enum class PetKind { Cat, Dog, Zebra };
1185 struct Dog : Pet {
1186 Dog() : Pet(PetKind::Dog) {}
1195 if (src && src->kind == PetKind::Dog) {
1196 type = &typeid(Dog);
1197 return static_cast<const Dog*>(src);