I have a basic base class and a couple of sub-classes which inherit from it.
Class Base{
public:
   Base(){};
   virtual ~Base();
   virtual void foomethod()=0; //Marked as pure virtual
};
Class A : public Base{
   A(){};  //Ctor
   ~A(){}; //Dtor
   void foomethod(){ /* DO SOMETHING */ }
}
Class B : public Base{
   B(){};  //Ctor
   ~B(){}; //Dtor
   void foomethod(){ /* DO SOMETHING */ }
}
Use of the above is throwing an error in the following usage:
Base a = A();
Base b = B();
The compiler is complaining about the function foomethod() being pure virtual.
However, when the following is used, there is no problem.
A a = A();
B b = B();
I would have thought that the first instance should be accepted due to C++'s principles of polymorphism. I want to enforce a specific method implementation of the method in sub-classes. If it is marked as virtual only, there is not guarantee that it will be explicitly overrided.
 
     
    