I have a class Small and a class Big I create a variable Small in the Big class Small small and in the Small class

char_traits

int operator()(int a) { return a; } — whats the oprator() doing there?

it's a fairly simple one

it's overloading operator()

it's a function call operator

then you can call the function operator on instances of that class

ohh.. ok sorry, forgot i can oveload () operator

Note that you just need to declare the class template for the general case (before you specialize), not define it.

Class obj;
obj(10);

struct S{ int operator()(int a){ return a; }}; int main(){S s; std

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: