В python вы можете, например, вызвать array.sort (), и он будет сортировать массив, в котором он вызывается.Тем не менее, теперь у меня есть следующий фрагмент кода
void drawClickableRectangle(ClickableRectangle recto){
ofSetHexColor(0xffffff); // just some syntax from the library I'm using
ofFill();
ofDrawRectangle(recto.xpos, recto.ypos, recto.width, recto.height);
}
и затем вызовите этот метод здесь:
ClickableRectangle recto(1,1,100,100);
recto.drawClickableRectangle(recto);
Это полный класс:
class ClickableRectangle
{
// Access specifier
public:
// Data Members
int xpos, ypos, width, height;
ClickableRectangle(int x1, int y1, int width1, int height1){
xpos = x1;
ypos = y1;
width = width1;
height = height1;
};
// Member Functions()
int getxpos()
{
return xpos;
}
int getypos(){
return ypos;
}
int getwidth(){
return width;
}
void drawClickableRectangle(ClickableRectangle recto){
ofSetHexColor(0xffffff);
ofFill();
ofRect(recto.xpos,recto.ypos, recto.width, recto.height);
//ofDrawRectangle(recto.xpos, recto.ypos, recto.width, recto.height);
}
IsЕсть ли способ сделать вызов функции "рефлексивным"?Поэтому я могу назвать это просто:
recto.drawClickableRectange();
Я относительно новичок в C ++, но не в программировании в целом.Спасибо!