Q:

Can this be done?

I was wondering if the following was possible:
class foo
{
  virtual void bar();
}

class izy : public foo
{
 int a;
 virtual  void bar()
 {
  a = 2;
 }
}

foo *anyfoo = new izy;
anyfoo.bar();

essentially what I want to know is, can I add the variable a or will a be nonexistant since its not part of the base class foo?

A:

yes, you can add new  Variables and Methods in subclasses.

