How do you create an instance of a class in C++
<p>I'm a C++ beginner. I have a class and when I try to compile it says it's missing 'main'.</p>

<p>What do I need to do to create an instance of this class and access its methods?</p>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;

using namespace std;

class Account
{
      string name;
      double balance;

  public:
      Account(string n);
      Account(string n, double initial_balance);

      string get_name() const;
      double get_balance() const;

      void deposit(double amount);

      void widthdraw(double amount);

};
</code></pre>

<p><strong>edit:</strong></p>

<p>Where do I put the main method?</p>

<p>I have tried putting it in a different file like the following</p>

<pre><code>    #include &lt;Account&gt;
    int main(){
    Account:: Account(string n) : name(n), balance(0){}
    return 0 ;
    }
</code></pre>

<p>but this gives an error saying there is not Account in the directory. I'm guessing this is because it's not compiled</p>

<p><strong>edit:</strong></p>

<p>Both files are in the same directory</p>

<p><strong>account_main.cc</strong></p>

<pre><code>    #include&lt;string&gt;
    #include &lt;iostream&gt;
    #include "Account.cc"

    Account:: Account(string n) : name(n), balance(0){} 
    int main()
    {
        Account account("Account Name"); // A variable called "account"
        account.deposit(100.00); // Calls the deposit() function on account

        return 0 ;
    }
</code></pre>

<p><strong>Account.cc</strong></p>

<pre><code>#include&lt;string&gt;
#include &lt;iostream&gt;

using namespace std;

class Account
{
      string name;
      double balance;

  public:
      Account(string n);
      Account(string n, double initial_balance);

      string get_name() const;
      double get_balance() const;

      void deposit(double amount);

      void widthdraw(double amount);

};
</code></pre>
