1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _SDL_render_h
# include <SDL_render.h>
#endif
 
class DisplayObject {
private:
    SDL_Texture* texture;
    int _x;
    int _y;
    int _w;
    int _h;
    double _rotate;
    SDL_Renderer* renderer;
public:
    bool render(){}
 
    /// get, set ///
    int x(){ return _x; }
    int y(){ return _y; }
    int w(){ return _w; }
    int h(){ return _h; }
    double rotate(){ return _rotate; }
 
    void x(const int& x){ _x = x; }
    void y(const int& y){ _y = y; }
    void w(const int& w){ _w = w; }
    void h(const int& h){ _h = h; }
    void rotate(const double& rotate){ _rotate = rotate; }
};
 
 
cs

1) getX, getY, setRotate... get/set 쓰기도 귀찮고 나중에 엿같이 길어질까봐 저렇게 했는데 괜찮은가?
특히 언더바 _ 는 인터넷에 보니 극렬하게 쓰지 말라는 사람도 있고 걍 온건한 사람도 있고...

2)const type& var 와 type var; 차이가 있는가?

void x(const int& x){ _x = x; }
void x(int x){ _x = x; }

저게 무슨 거대한 크기의 type이면 확실한 성능차이가 나겠지만
그냥 기본 자료형(int, double...)같은 경우는 어떤지?