You an Animal class with children classes Herbivore and Carnivore for example. Then each child implements its own overriden version of function feed ().
Even when the implementation is different for each kind of animal, you know that for any animal you can call the function feed for it and it will have the right behavior, this is Polymorphism.
Now imagine you have two pokemons in the pension and one day you come and the okd lady says "Your pokemons came back wih an egg, we don't know where they found it but here it is". So you got a behavior: receive an egg. But there is some internal hidden behavior : You don't know where it comes from. You know what happens but not how. This is encapsulation; you have access to some interface function but not access to the parameters it plays with
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.