title: Abstract base class c++
body: <pre><code>enum InputType
  {
      VideoInputType,
      ImageInputType,
      VideoStreamInputType   
  };
  
  class AbstractInput
  {
  public:
      AbstractInput(std::string);
      virtual InputType Type()=0;
      std::string GetName();
      virtual std::string GetFullName()=0;    
      std::string Name;
  
  };
  
  
  
  class VideoInput : AbstractInput
  {
  public:
      VideoInput(std::string,std::string);
      virtual InputType Type();
      virtual std::string GetFullName(); 
  
      std::vector&lt;cv::Mat&gt; Data;
  
  };
  
  class ImageInput : AbstractInput
  {
  public:
      ImageInput(std::string,std::string);
      virtual InputType Type();
      virtual std::string GetFullName();
  
      cv::Mat Data;    
  };
  </code></pre>
  
  <p>My plan was use AbstractInput as a function parameter. Since AbstractInput is abstract class no instance could exist. But in my opinion an AbstractInput&amp; which refers to either VideoInput or ImageInput may exist.</p>
  
  <p>My code that not works:</p>
  
  <pre><code>VideoInput vidInput(ui-&gt;nameLineEdit-&gt;text().toStdString(),path.toStdString());
  AbstractInput &amp;absInput=vidInput;
  </code></pre>
  
  <p>Error:</p>
  
  <p>'AbstractInput' is an inaccessible base of 'VideoInput'</p>
  
  <p>How can I implement the behavior I want?</p>
  
  <p>Thanks in advance.</p>