88 lines
1.2 KiB
C
88 lines
1.2 KiB
C
|
|
|
||
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
class classB{
|
||
|
|
|
||
|
|
int propertyFromC = 111;
|
||
|
|
|
||
|
|
void methodFromC() {
|
||
|
|
|
||
|
|
printf("Please print much much..");
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
class classA{
|
||
|
|
|
||
|
|
int propertyFromC = 100;
|
||
|
|
|
||
|
|
void methodFromC() {
|
||
|
|
|
||
|
|
printf("Don't print soo much...");
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
class inherit extends a, classB, classA{
|
||
|
|
|
||
|
|
int propertyFromC = 20;
|
||
|
|
|
||
|
|
void methodFromC() {
|
||
|
|
|
||
|
|
printf("this is a method from c\n\n");
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
printf("from c: a : %i\n", this->propertyFromA);
|
||
|
|
printf("from c: b : %i\n", this->propertyFromB);
|
||
|
|
printf("from c: c : %i\n", this->propertyFromC);
|
||
|
|
|
||
|
|
this->propertyFromB++;
|
||
|
|
|
||
|
|
this->methodFromA();
|
||
|
|
|
||
|
|
this->propertyFromB++;
|
||
|
|
|
||
|
|
this->methodFromB();
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
class a extends b{
|
||
|
|
|
||
|
|
int propertyFromA = 10;
|
||
|
|
|
||
|
|
void methodFromA() {
|
||
|
|
|
||
|
|
printf("this is a method from a\n\n");
|
||
|
|
|
||
|
|
printf("from a: a : %i\n", this->propertyFromA);
|
||
|
|
printf("from a: b : %i\n", this->propertyFromB);
|
||
|
|
printf("from a: c : %i\n", this->propertyFromC);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
class b{
|
||
|
|
|
||
|
|
int propertyFromB = 1234;
|
||
|
|
|
||
|
|
void methodFromB() {
|
||
|
|
|
||
|
|
printf("this is a method from b\n\n");
|
||
|
|
|
||
|
|
printf("from b: a : %i\n", this->propertyFromA);
|
||
|
|
printf("from b: b : %i\n", this->propertyFromB);
|
||
|
|
printf("from b: c : %i\n", this->propertyFromC);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|