Object orientism is not inheritance. It is simply encapsulation and having functions attached to the data.
Another point of view is that it's a new kind of de-encapsulation.
Apparently this is a 'global' variable:
int variable = 0;
void foo() {
variable++;
}
void bar() {
variable++;
}
but this is an 'encapsulated' variable: class MyClass {
int variable = 0;
void foo() {
variable++;
}
void bar() {
variable++;
}
}
You can block the top one in a code-review because "global variable", and tell the developer to fix it by passing the variable in and out of functions when needed, but I have a feeling the bottom one's getting merged even if you object on the same grounds.I.e. OOP is a style of programm organization (readily realizable under CLOS) where we associate operations with the leftmost argument and its type.