C++ Classes - Part 3 of 3 - Inheritance, Polymorphism, Virtual Functions, and Dynamic Casting

preview_player
Показать описание
An in-depth look into inheritance, polymorphism, virtual functions, dynamic casting, and refactoring class structures in the C++ programming language.

Bradley Sward is currently an Associate Professor at the College of DuPage in suburban Chicago, Illinois. He has earned a Masters degree in Software Engineering from DePaul University, a Masters degree in Computer Science from the University of Illinois at Springfield, and two Bachelors degrees in Computer Science and Molecular Biology from Benedictine University. Prior to teaching, Bradley worked for five years in the field of casino gaming on a variety of video slot machine and poker games. The Village People have been permanently etched into his brain.
Рекомендации по теме
Комментарии
Автор

Good explained virtual function in C++

computerlearningbyargusaca
Автор

YOU ARE AWESOME, YOU SHOULD ALSO RECORD ALGORITHIMS DATA STRUCTURES IN C++

MRMIT-CS
Автор

Great explanations! I have 2 questions:

1. Near the end of the video, you removed Point3D before demonstrating the dynamic cast would then work as intended when the hierarchal structure was only 2 layers deep. Is there anyway to solve the dynamic casting issue if Point3D was still on the bottom layer of the hierarchy? Something like the equivalent of "instanceof" in Java? I assume there must be a way to achieve this, as Point3D inheriting from Point2D seems like a natural way to architect a program like this, unless there is another way of organizing things altogether?

2. When you created the pure virtual function inside of Point, it reminded me very much of abstract functionality that is apparent in other languages like Java and C#. Does C++, like those other languages, also limit the creation of instances of the Point class (effectively making the entire class abstract), or does the presence of a pure virtual function inside of a class have no other limitations to how that class behaves other than forcing the children to define the function?

Thank you in advance!

DavidCampbellIII
join shbcf.ru