O
onkar
SomeClass{
public:
int i;
SomeClass(int j):i(j){};
operator int(){
return this->i;
}
// some functions (all of them public) and
constructors ??
};
int main(void){
SomeClass s(10);
int i=s;
cout<<i<<endl;
return 0;
}
I am not able to understand why this is printing 10 ??? How is
"operator int()" function called ??
public:
int i;
SomeClass(int j):i(j){};
operator int(){
return this->i;
}
// some functions (all of them public) and
constructors ??
};
int main(void){
SomeClass s(10);
int i=s;
cout<<i<<endl;
return 0;
}
I am not able to understand why this is printing 10 ??? How is
"operator int()" function called ??