EECS 280 Lecture Notes - Lecture 10: Virtual Function, Virtual Memory, Liskov Substitution Principle

96 views4 pages

Document Summary

Polymorphism is the idea that if you have an object, it can take on any type of characteristics, depending on what it is. It"s the ability to associate many behaviors with one function name. Base class constructors run even without a constructor for the derived class. They run in the order in which they are mentioned in the definition. When there is no constructor, the variable is initialized to a random number in junk. //this just means that you can access what"s public in base2 and base3 //through the derived4 class in main. cpp. You can upcast classes (which means refer to an "isosceles" as a "triangle"), but you can"t downcast (a "triangle" might not be isosceles"). Because the base class is always represented at the top: A derived type inherits the member functions and member variables from its parent base class. //public - everything in triangle can be accessed in isosceles and by anyone //who uses isosceles. uses isosceles.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents