ExamVeda
Login
Home
C plus plus miscellaneous
?

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;
	}
};

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.