void (*PointToMouseClick)() = NULL;
void (*PointToMouseRelease)() = NULL;
bool ClickAvailable;
...
void MouseClick();
void MouseRelease();
void Model::MouseClick(){
if(PointToMouseClick!=NULL)
(*PointToMouseClick)();
}
void Model::MouseRelease(){
if(PointToMouseRelease!=NULL)
(*PointToMouseRelease)();
}
std::vector<Model> Models;
Models[32].PointToMouseClick=&ButtonOnPress;
void ButtonOffPress(){
for(int i = 0; i <15;i++)
Models[i].Color = glm::vec3(0.0f,0.0f,0.0);
}
// Компилятор уже не ругается, но мы получаем очень интересный вывод в консоль.
// В итоге если у нас деструктор срабатывает дважды, при одном созданном объекте,
// один раз сейчас, второй раз после завершения main()
delete &BaseClassObj;
Main function start now.
Constructor BaseClass has been called
Value2 after resetting Value2. Get value like BaseClass::Value2 (static member of class) - 15
Overloaded function with one argument (int a). Argument value is - 1
Overloaded function with two integer arguments (int a, int b). Sum arguments - 3
Overloaded function with two double arguments (double a, double b). Division arguments - 0.280255
Delete anythig used by BaseClass class
Constructor BaseClass has been called with argument. this->Value1 now is equal 2
Delete anythig used by BaseClass class
Delete anythig used by BaseClass class