Function "was not declared in this scope"
<p>I'm new to C++ and get a beginner's mistake:</p>

<blockquote>
  <p>myclass.cpp: In function ‘int main()’:<br>
  myclass.cpp: 14:16: error: ‘func’ was not declared in this scope</p>
</blockquote>

<p>This is the code:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class MyClass{
public:
    int func(int);
};

int MyClass::func(int a){
    return a*2;
}

int main(){
    cout &lt;&lt; func(3);
}
</code></pre>

<p>I hope you can help me.</p>
