Witam, chciałbym się was zapytać czy ten kod (patrz w dół) jest prawidłowy, bo działa dobrze ale czy takie coś jest dobre.
#include <iostream>
using namespace std;
class A
{
protected:
int a;
int b;
int c;
};
class B: public A
{
public:
B(int d,int e, int f)
{
a=d;
b=e;
c=f;
}
void ustaw()
{
a=3;
b=4;
c=6;
}
void wyswietl()
{
cout<<a<<endl<<b<<endl<<c<<endl;
}
};
class C: public A
{
public:
void ustaw()
{
a=20;
b=100;
c=120;
}
void wyswietl()
{
cout<<a<<endl<<b<<endl<<c<<endl;
}
};
int main()
{
B b(29,56,123);
//b.ustaw();
b.wyswietl();
C c;
c.ustaw();
c.wyswietl();
b.wyswietl();
return 0;
}