C++ Example 60 - Basic Inheritance and polymorphism/virtual functions (part 1)

preview_player
Показать описание
Support:
- Udemy courses coming soon!

Links:

-C++ Tutorials:
-SFML:
-SFML Sidescroller:
-SFML Open World RPG:
-SFML Simple Games and Apps:
-SFML Games in ONE VIDEO:
-Livestreams:

#gamedeveloper #2dGames #programming
Рекомендации по теме
Комментарии
Автор

You are the best. Thank you for all of these tutorials

Shentinel
Автор

Your videos have been amazing. They have helped me so much!

kylegarland
Автор

Hi Suraj,

Thanks for the great inheritance tutorials. I have been able to get one project I am working on started with the info I have learned here. I was hoping you could answer one question.

I am trying to write code for a two player die game where the base class is a Die class and the derived class is a LoadedDie class.

Now, based on user input (each player can pick whether they want to play with a normal die or a loaded die) I have to create a Die object.

I am using a switch statement to handle the decision logic based on user preference, but is there a type of variable that can hold either a Die object or a LoadedDie object?

I want to have something like player1ChosenDie in my Game class. And want to return a Die or a LoadedDie object from a method to a member variable.

I hope I was able to explain myself and wondering if you have any suggestions for this situation.. Thanks!

TJKhara
Автор

Thank you so much for this!

Was kinda confused with inheritance and c++ but it turns out it was not that much different from java lol.

Ownagelif
Автор

Hey Suraj, why your getters return reference? Because you return with “*this” ?

YusufPatoglu
Автор

nice video, but messy a bit, also, it's is not recomented use "using" in headers

sergiutacu