Vererbung, Polymorphie und Kapselung