• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Why or when to use const on pointers? TFS 1.2

gudan garam

Advanced OT User
Joined
Feb 13, 2011
Messages
353
Solutions
17
Reaction score
173
Location
São Paulo.
Hey, so I have a simple question

that is when or why to use, for example

Code:
const Tile* playerTile = player->getTile();

instead of

Code:
Tile* playerTile = player->getTile();
 
So, basically its a way to instead of copying the whole object which would cost memory, we get a reference to it and to not be able to change it, use const?
 
Back
Top