title: C++ equivalent of C# nested private classes
body: <p>I am learning C++ coming from C#. In C#, there can be classes such as the following:</p>
  
  <pre><code>public abstract class BankAccount
  {
    private BankAccount() {} // prevent third-party subclassing.
    private sealed class SavingsAccount : BankAccount { ... }
    private sealed class ChequingAccount : BankAccount { ... }
    public static BankAccount MakeSavingAccount() { ... }
    public static BankAccount MakeChequingAccount() { ... }
  }
  </code></pre>
  
  <p>This way, consumers do not worry about the type of <code>BankAccount</code> and cannot nest their own subclasses.</p>
  
  <p>Is there an equivalent way to do this in C++?</p>