?
Given the below class, what is the correct syntax of declaring a functor that adds 10 to each of the passed argument?
Given the below class, what is the correct syntax of declaring a functor that adds 10 to each of the passed argument?
class Add
{
int x;
public:
Add(int x){
this->x = x;
}
int operator()(int a){
return x+a;
}
};
class Add
{
int x;
public:
Add(int x){
this->x = x;
}
int operator()(int a){
return x+a;
}
};
Join the Discussion
Login to post a comment or share your explanation.
Login