I saw this while browsing a C++ reference. I don't understand what myobject is when it's between the } and ;Code:struct myclass { bool operator() (int i,int j) { return (i<j);} } myobject;
I saw this while browsing a C++ reference. I don't understand what myobject is when it's between the } and ;Code:struct myclass { bool operator() (int i,int j) { return (i<j);} } myobject;
now it makes more sense!Code:struct { bool operator() (int i,int j) { return (i<j);} } isSmaller; int x=10, y=20; isSmaller(x, y);
..which in the context of C++, thus a C++ struct, is the same as a class except that in structs all members default to public...rather an instance of struct myclass