I am having trouble figuring out why this program works. I wrote it based on my notes (OOPP and classes) but I do not understand how exactly it works? I would appreciate any help!
Here is the code:
#include <iomanip>
#include <iostream>
using namespace std;
class Base{
public:
void f(int) {std::cout<<"i";}
};
class Derived:Base{
public:
void f(double){std::cout<<"d";}
};
int main(){
Derived d;
int i=0;
d.f(i);
}
I have tried making cout statements to show me how everything is passed and runs, but it will not allow me to cout anything.