<p>Actually my question is all in the title.<br>
Anyway:<br>
I have a class and I use explicit constructor:
<br>.h<br></p>

<pre><code>class MyClass
{
  public:
    explicit MyClass(const string&amp; s): query(s) {}
  private:
   string query;
}
</code></pre>

<p>Is it obligatory or not to put <b>explicit</b> keyword in implementation(.cpp) file?</p>

No, it is not. The
```
explicit
```
keyword is only permitted in the header. My gcc says:
```
```
test.cpp:6: error: only declarations of constructors can be 'explicit'
```
```
for the following code:
```
```
class foo {
public:
    explicit foo(int);
};

explicit foo::foo(int) {}
```
```