This commit is contained in:
Miloslav Ciz 2024-08-31 14:44:45 +02:00
parent 124b9d1e7c
commit 3f374a4713
85 changed files with 2281 additions and 2272 deletions

6
oop.md
View file

@ -132,7 +132,7 @@ Cat::Cat(const char *name): Animal(name)
{
this->treesClimbed = 0;
}
Dog::Dog(const char *name): Animal(name)
{
this->ballFetched = 0;
@ -307,7 +307,7 @@ int main(void)
for (int i = 0; i < ANIMALS; ++i)
{
printf("%s: ",AnimalGetName(animals[i]));
animals[i]->makeSound(animals[i]);
animals[i]->makeSound(animals[i]);
putchar('\n');
}
@ -383,4 +383,4 @@ int main(void)
}
```
Notice the lack of bullshit. OOPers will argue something about scalability or something, but that's argument of [bloat](bloat.md) so it's invalid -- basically they tell you "just wait till you have 10 million lines of code, then it becomes elegant", but of course, such code is already bad only by its size -- code of such size should never be written. They will also likely invent some highly artificial example tailored to suit OOP which you will however never meet in practice -- you can safely ignore these.
Notice the lack of bullshit. OOPers will argue something about scalability or something, but that's argument of [bloat](bloat.md) so it's invalid -- basically they tell you "just wait till you have 10 million lines of code, then it becomes elegant", but of course, such code is already bad only by its size -- code of such size should never be written. They will also likely invent some highly artificial example tailored to suit OOP which you will however never meet in practice -- you can safely ignore these.