0

Suppose having a simple class with no name:

class {} object;

I want my class to have at least one non-default constructor like below

class {
public:
    ctor(int member) : _member(member) {}
private:
    int _member;
} object(20);

I dont want my class to have a name. Am I able to do such things or am I forced to give a name to the class?

arsdever
  • 1,111
  • 1
  • 11
  • 32
  • 1
    Answered here https://stackoverflow.com/questions/21894450/how-to-add-constructors-destructors-to-an-unnamed-class by the very same guys who would probably have answered it today. – JohnFilleau Feb 22 '20 at 20:48
  • Why don’t you want it to have a name? – Pete Becker Feb 22 '20 at 21:51
  • It is a functor class and will be passed to a thread. I didn't want to give it a name but it came to be impossible. – arsdever Feb 24 '20 at 08:38

0 Answers0