#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();
	SintBernard* sbp(dynamic_cast<SintBernard*>(hp));
	if (sbp)
		std::cout<<sbp->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.

*/
