Indeed, OOP using "tricky methods" is a major problem. 😆
[Excerpt from an introductory textbook on computer science.]
Indeed, OOP using "tricky methods" is a major problem. 😆
[Excerpt from an introductory textbook on computer science.]
This gem a couple of paragraphs later on OOP:
"This approach has magically brought about an evolution in the software world."
Magic. 😆
A couple of pages later, listing characteristics of C++:
I suppose this definition also serves to illustrate recursion. 😀
A rather interesting first C++ program. 😢
[From an actual CS intro textbook. No surprise, it doesn't compile in any compliant C++ compiler in any version of C++, all the way back to C++98: https://godbolt.org/z/x4Kc3x8sh]
[Of course, void main works in MSVC but "iostream.h" and unqualified cout?]
Not surprised to see the claim that "C++ is a superset of C" in this book.
Also, C++ programmers should know they're a privileged bunch.
Words fail me, and my worry for students grows. 😢
Ah yes, we can use the exit function to end a program. I just wasn't expecting to find it discussed in a textbook for a CS intro course, that too about 20% of the way in. 🤦♂️
[FWIW, I don't recall ever using the exit function in all my programming.]
I don't quite get why intro C++ courses teach arrays, 2-dimensional arrays no less.
In the same vein, why teach null-terminated strings (beyond literals)? They have so many pitfalls that even the authors can't keep things straight. 😢
Ahem. A C++ void function *must not* include a return statement.
#cpp #cplusplus #teaching #functions
EDIT: please see the reply from @glloyd and my reply to that. I apologize for, in being brief, suggesting that a void function cannot at all have a return statement.
https://elk.zone/fosstodon.org/@glloyd/110299354968932782
"Teaching C++ is easy. After all, I know C."
Also, that reason to declare functions: 🤦♂️
"You keep using that word "template" in unfortunately incorrect/confusing ways." 😢
At this point, I mean why not just go with this imperative on structs? 🤦♂️
Sure, if by "declaration", you mean "instantiation".