in hedear file(.h):
Code:
class test{
private:
bool blVisible;
public:
void Show();
bool Visible()
{
return blVisible;
}
void Visible(bool value)
{
blVisible=value;
if (value==true) Show();//call the event
}
};
and in main.cpp:
Code:
#include <iostream>
#include "test.h"
#include <conio.h>
#include <fstream>
using namespace std;
test a;
void test::Show()
{
cout << "showed";
}
int main()
{
//read data
bool b;
cin >> b;
a.Visible(b);
cin.clear();
cin >> b;
a.Visible(b);
getch();
return 0;
}
just see these 2 lines:
Code:
test a;
void test::Show()
imagine that we do another: 'test c;'
the 'void test::Show()' will be the same and do the same cout
how can i work like these:
'void varname::Show()'??