(correct me if i mistake)
the Global Scope is for create and initializate variables, create functions\class's\namespaces and more... i understand that.
(sorry if my question is confuse.... but i'm trying work with my english :()
when we build a class with some variables, is there any way, on Global Scope, that we can change the variables values with object name?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#define event(eventname, ... ) std::function<void(__VA_ARGS__ )> eventname
class test
{
public:
event(Soma,(int a,int b)) ;
event(hello);
void write(string a)
{
Console.write(a);
Soma(2,3);
}
};
test a;
//
int a.Soma = [](int a, int b)
{
COORD v={10,10};
Console.SetCaretPosition(v);
Console.SetColorAndBackground(ForeColorRed,0,true);
Console.write("\nMessage Printed\n" ,a+b , "\n") ;
return 0;
}
|
(console is my class for work with console)
like you see i'm trying changing the Soma value on Global Scope... i'm geting errors. my question is: is there anyway for validate that for don't get errors?
erro message:
'error: expected initializer before '.' token'
without a return type:
'error: 'a' does not name a type'
please i'm trying, several time, fix these code without sucess :(