#include <iostream>

class Hond {
public:
	virtual ~Hond() {
	}
	virtual void blaf() const {
		std::cout<<"Blaf."<<std::endl;
	}
// ...
};

class SintBernard: public Hond {
public:
	SintBernard(int w=10): whisky(w) {
	}
	virtual void blaf() const {
		std::cout<<"Woef!"<<std::endl;
	}
	int geefDrank() {
		std::cout<<"Geeft drank."<<std::endl;
		int i(whisky);
		whisky=0;
		return i;
	};
// ...
private:
	int whisky;
};

void geefHulp(Hond* hp) {
	hp->blaf();
//	std::cout<<hp->geefDrank()<<" liter."<<std::endl;
//	[C++ Error (Borland)]   'geefDrank' is not a member of 'Hond'
//	[C++ Error (Microsoft)] 'geefDrank' : is not a member of 'Hond'
//	[C++ Error (gcc)]       'class Hond' has no member named 'geefDrank'

//	We kunnen de compiler wel dwingen maar dat geeft foutieve uitvoer!
	std::cout<<static_cast<SintBernard*>(hp)->geefDrank()<<" liter."<<std::endl;
}

int main() {
	Hond* borisPtr(new SintBernard);
	geefHulp(borisPtr);
	delete borisPtr;
	std::cin.get();
	borisPtr=new Hond;
	geefHulp(borisPtr);
	delete borisPtr;
	std::cin.get();
	return 0;
}

/*
Output:

Woef!
Geeft drank.
10 liter.

Blaf.
Geeft drank.
6684840 liter.

*/
