jeudi 27 avril 2017

Error defining explicit operator bool() outside class

I have problem defining operator bool() function outside the class

class A{

public:
    explicit operator bool() const; 
};

I am defining the function outside class as...

explicit A::operator bool() const {
    ...
}

I get this error - error: ‘explicit’ outside class declaration

What is it that am doing wrong? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire