C++ Example 56 - Assignment operator overloading with DICE, and random numbers in an array!

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
Рекомендации по теме
Комментарии
Автор

Suraj,

I am a little confused here.

Why do we do this?

// Functions
inline const int& getValue()
{
return *this->value;
}

Specifically, why do we return *this->value and not this->value

In an earlier example video, when the member variable was an int and not a pointer we were returning this->value

However, here the member variable is a pointer so we return *this->value...

I am not clear here. I know that *this refers to this object (or the value to where the this pointer points.) So are we first dereferencing that to get to the object and then using -> to get to the member variable inside?

I think a little explanation from you would help me understand this better.

Thanks.

TJKhara
Автор

What's the default random stuff? Is it the:
#include <iostream>
#include <random>
#include <ctime>

using namespace std;

int main() {
default_random_engine Random(time(NULL));
uniform_int_distribution<int> RandomInt(0, 1000);

cout << (RandomInt(Random)) << endl;

cin.get();
return 0;
}
?
I learned that last year until I learned about srand xD Suprised I could even remember that lmao

_daniel.w
join shbcf.ru