i build these code. it's very cool:
in test.h:
class test
{
private:
bool blVisible;
int x=0,y=0;
public:
void Show();
bool Visible()
{
return blVisible;
}
void Visible(bool value)
{
blVisible=value;
if (value==true) Show();//call the event
}
};
in main.cpp:
include <iostream>
#include "test.h"
using namespace std;
test a;
void test::Show()//the 'event' procedure
{
cout << "showed";
}
int main()
{
//read data
bool b;
cin >> b;
a.Visible(b);
cin >> b;
a.Visible(b);
return 0;
}
these code works fine. but imagine that you have 2 test varables, we get the same cout:(
so, how can i change these line:
void test::Show()//the 'event' procedure
for be used with diferent variables names?
(like these 'void a::Show()')