#include<iostream>
using std::cout;
class Channel {
protected:
	int buff;
public:
	void printbuffaddrChannel() {cout <<"buff seen in Channel:"<<&buff << "\n";}
};
class Input: public Channel {
 public:
	virtual void in(int val) { buff=val;}
	void printbuffaddrInput() {cout << "buff seen in Input:" << &buff << "\n";}
};
class Output: public Channel {
 public:
	virtual int out() { return buff;}
	void printbuffaddrOutput() {cout << "buff seen in Output:" << &buff << "\n";}
};
class UnsecuredIO : public Input, public Output {  };
int main () {
 // Channel *c = new UnsecuredIO(); sorry! functions are not defined

 UnsecuredIO *u = new UnsecuredIO();
 Input *in=u;
 Output *out = u;
 cout <<"on u, ";
 u->printbuffaddrInput(); 
 cout <<"on u, ";
 u->printbuffaddrOutput();
 cout <<"on in, ";
 in->printbuffaddrChannel();
 cout <<"on out, ";
 out->printbuffaddrChannel();
 in->in(25);
 int x = out->out();
 cout<<x << "\n";

 u->in(25);
 x = u->out();
 cout<<x << "\n";

}


