Last active
August 1, 2016 15:44
-
-
Save thomasvanta/bb58e8e28e2692f24f66f7d398f1be29 to your computer and use it in GitHub Desktop.
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
//from simon geilfus: https://github.com/simongeilfus/FlyingTokyo19 | |
//Pass an argument by value when it is a built-in type or a small object (Passing by value makes a copy of the object) : | |
void firstFunction( int number, bool boolean ); | |
//Pass an argument by reference when you want the argument to be read-write: | |
void secondFunction( Rectf &rectangle ); | |
//Pass an argument by const reference when you want the argument to be read-only (Read-only also ensure that your data won't be unecessarely copied when calling the function): | |
void thirdFunction( const vector<gl::Texture> &textures ); | |
//When writting a class's method that doesn't modify the content of the class mark it as 'const'. | |
class MyClass { | |
public: | |
string getName() const; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment