Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and simplify a bit
- Loading branch information
Showing
1 changed file
with
7 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8dc19ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one :) Can't get enough of getting rid of those nasty C-style casts ^^
8dc19ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ssj17vegeta since C++11 theres excplicit type cast (Old C Style cast) which does interesting things. Only cast it doednt cover is dynamic_cast
8dc19ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Laizerox dont try to make us thing that automatic casting method choosen by c++11 compiler will be better than the one we choose ourself in our specific case.
We know that it will be easier...
Its a good practice to do explicit type casting even now, so its recommended to do that for cmangos devs.
Anyway its ugly and we do too much of them mainly because we dont respect enough POO scheme.
8dc19ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyberium fair enough, I was just pointing such thing exist. However instead of doing casts everywhere we should probably move towards functions that return converted object?
It has been discussed alot but no one done it yet.
static_cast<Pet*>(object)->method();
object->toPet()->method();
object->convert<Pet*>()->method();
Pick your method :)