EECS 280 Lecture Notes - Lecture 16: Stellar Classification, Function Overloading, Name Binding
Document Summary
When driver runs, looks for members in derived class, if not found then goes to base class. Ability of one code to take on many forms depending on how it"s used. Different polymorphism: subtype polymorphism (this is the one they mean when people refer to plmphms), ad-hoc polymorphism (function overloading). Function overloading: several functions in one scope with the same name but different signatures (signature includes name and parameter types, but. Object slicing, this leads to potentially losing a lot of important info/data). Bird b = c; //problem because chicken is larger data than bird. Solution: we use pointers or references to work with objects indirectly! a bird* and a chicken* take the same amount of space because they are both addresses! //bird is one type, that is pointing to a different type chicken. Static vs dynamic type static type: of a pointer/ref is the type it is declared with and known at compile time.