title: Strategy Pattern C++
body: <p>I want implement the strategy pattern in C++ but I have a doubt. Alwyas the strategy patterns examples are than follow code (in C#). I want modify the client, i.e MainClass, such that choose the concrete strategy will be dynamic way.
  For example, passing the strategy name by the args[] parameters of the main method. How I will be able to implement this without modify the properties of this pattern?.</p>
  
  <pre><code>namespace StrategyPatterns
  { 
    // Interface definition for a Sort algorithm
    public interface ISort
    {
    void Sort(List&lt;string&gt; list)
    }
  
    // QuickSort implementation
    public class CQuickSorter : ISort
    {
      void Sort(List&lt;string&gt; list)
      {
        // Here will come the actual imp
      }
    }
  
     // BubbleSort
    public class CBubbleSort : ISort
    {
      void Sort(List&lt;string&gt; list)
      {
        // The actual imp of the sort
      }
    }
  
    public class Context
    {
     private ISort sorter;
  
     public Context(ISort sorter)
     {
       // We pass the context the strategy to use
       this.sorter = sorter;
     }
  
  public ISort Sorter
   {
    get{return sorter;)
   }
  }
  
  public class MainClass
  {
      static void Main()
       {
         List&lt;string&gt; myList = new List&lt;string&gt;();
  
         myList.Add("Hello world");
         myList.Add("Another item");
  
         Contexto cn = new Contexto(new CQuickSorter());
         cn.Sorter.Sort(myList);
         cn = new Contexto(new CBubbleSort());
         cn.Sorter.Sort(myList);
      }
    }
  }
  </code></pre>