Skip to content

Base class can access derived member function ?? #3240

Answered by faalbers
faalbers asked this question in Q&A
Discussion options

You must be logged in to vote

Never mind !! The manual explains why ! Duh !!!

The function returned a Dog instance, but because it’s a non-polymorphic type behind a base pointer,
Python only sees a Pet. In C++, a type is only considered polymorphic if it has at least one virtual function
and pybind11 will automatically recognize this:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by faalbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant