[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Virtual question



Hey people,



	Let me get right to it. If I have a class like:


class Base {

  private:
    int base_data;

  public:
    virtual void print_data(void) { printf("%d", base_data); }

}


	And then derive a class like:


class Derived : public Base {

  private:
    int derived_data;

  public:
    void print_data(void) { printf("%d - %d", base_data, derived_data);
}

}


	Does the whole polymorphism deal only work when I have pure virtual
functions, or does it still work in this case?




Thank you for your attention,
Miguel A. Osorio.