Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          avoid-hiding-inherited-names/prog0.cc - A class B inherits two virtual, overloaded functions from A - straightforward - no problems.Lecture 5 - slide 9 : 40
Program 1

// For exercise.
// Class B inherits both overloads of the virtual functions vf.

#include <iostream>
#include <string>

using namespace std;

class A {
private:
   double a;
public:
  virtual void vf(double d){                // Virtual vf(double)
    cout << "virtual vf(double) in A: " 
         << d << endl;
  }

  virtual void vf(){                        // Virtual vf()
    cout << "virtual vf() in A" 
         << endl;
  }

};

class B : public A {
private:
  double b;
public:
  // B member functions here 
                                            // B inherites vf(double) and vf()
};


int main(){
  B *b = new B();
  
  b->vf();                                  // OK. A::vf() is called
  b->vf(5.0);                               // OK. A::vf(double) is called
}