#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

class a
{   
protected:
	int dana_a;
public:
	void wyslij(int &dana){dana=dana_a;};
	void zmieniaj(void)
	{	
		dana_a=(rand()%100);
	};
	a(){dana_a=100;
	    srand((unsigned)time(NULL));};
};

class b
{ 
protected:  
	int dana_b;
public:
	void odbierz(a liczba){liczba.wyslij(dana_b); printf("%d\n",dana_b);};
};

b b1;
a a1;


void main(void)
{
	while(1)
	{
		a1.zmieniaj();
		b1.odbierz(a1);
		Sleep(500);
	}
}

