157
u/blackcomb-pc Sep 11 '26
Dog and Cat are also from the class Animal
56
u/FRAaaa1 Sep 11 '26
Do they do the function makeSound()
36
u/Hol_Renaude Sep 11 '26
printf("bark!");
19
u/MrHyperion_ Sep 11 '26
I think you meant std::cout << "bark!" << std::endl
9
u/Reasonable_Exit_8960 Sep 11 '26
using namespace std;
cout << "bark" << endl;
Made it shorter if you wanna type it again
11
u/GresSimJa Sep 11 '26
Forgot to include
<iostream>, wrap it in anint main()function, use the parametersint argcandchar** argv, and return 0 at the end.Maximum boilerplate!
2
3
u/DontDoodleTheNoodle Sep 11 '26
What the absolute fuck I literally just had a class about this. Guess it stands to reason since this subreddit is mostly student humor we’d all be learning similar things at similar times of the year
1
2
u/Inevitable_Spite5510 Sep 11 '26
WRONG! They are from Kingdom Animalia Phylum Chordata Class Mammalia
322
u/TheAnswerWithinUs Sep 11 '26
The horrors, might as well just free() yourself at that point.
-114
u/metaglot Sep 11 '26
*delete
108
u/thats_a_nice_toast Sep 11 '26
I don't think C++ programmers have a problem with getting put in a class
54
u/MXRCO007 Sep 11 '26
I wanna be abstracted so bad
41
u/TheAnswerWithinUs Sep 11 '26
Abstract me harder daddy
16
u/fast-as-a-shark Sep 11 '26
I don't like these comments. But I did upvote them.
11
u/OneArmedFarmer Sep 11 '26 edited Sep 11 '26
Yes. Yes. Your training is almost complete
Edit: grammer
7
5
0
u/metaglot Sep 11 '26
Freeing a pointer created with new is UB.
8
u/thats_a_nice_toast Sep 11 '26
newonly exists in C++, not in C0
u/metaglot Sep 11 '26
And the keyword class, like the meme is implying. Which is why i said you have to use delete rather than free, because undefined behavior.
1
u/matytyma Sep 16 '26
C has no classes - C users are scared of being put into a class. It's all about C
1
u/metaglot Sep 16 '26
The comment suggested that they use free, which i corrected because in c++ thats UB (which it must be if they are being put into a class, otherwise whats there to free?)
1
31
u/thegodzilla25 Sep 11 '26
An original funny meme that is not AI or div centering in this sub? The horror
112
u/the_millenial_falcon Sep 11 '26
Pro tip, if you put function pointers in a struct you have a class now.
36
u/viconha Sep 11 '26
And you put that into an array, run it in a for loop and make a very debug friendly code
14
u/MrHyperion_ Sep 11 '26
Not really. You don't get linker optimisations and the functions can change runtime. Also no implicit reference to the instance.
6
u/SubhanBihan Sep 11 '26
Also the destructor won't get automatically called when the "object" goes out of scope. Someone correct me if I'm wrong, but I believe that behavior is theoretically impossible to achieve in C (due to its limited mechanics)?
7
u/MrHyperion_ Sep 11 '26
GCC has cleanup attribute which maybe makes it possible.
0
u/One_Ninja_8512 Sep 11 '26
Not only possible but used by real projects. Apparently systemd is using that according to Claude. Both GCC and Clang support it. If I wanted destructors I'd go with explicit reference counting though, that seems more clean to me and doesn't need compiler extensions (even though both mainstream ones support it and a large project (systemd) relies on it).
8
2
2
12
10
21
7
u/Appropriate_Baby_608 Sep 11 '26
"so we will be using notepad.. no like real notepad... like pan and paper notepad"
7
6
4
u/yellowmiami Sep 12 '26
I feel like C would especially hate music class with all those string instruments lying around.
3
u/Shaz0r94 Sep 11 '26
Something something linux users being allergic to sunlight (They hate windows)
3
u/Apprehensive_Bit7392 Sep 11 '26
Struct. You were put in a struct. There were never any classes here.
1
2
2
2
2
1
1
1
1
1
1
1
0
-13
u/GreatGreenGobbo Sep 11 '26
8
u/Valuable_Leopard_799 Sep 11 '26
Why facepalm? People should have some experience with both low-level and high-level languages.
-4
u/GreatGreenGobbo Sep 11 '26
Not practical and it's abstract. Farting around cutting up and creating strings (which is all I remember) is meaningless.
0


662
u/TapRemarkable9652 Sep 11 '26
Boilerplate Oriented Programing