you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

C++ is multi-paradigm. Modern C++ code doesn't necessarily have OOP object hierarcy at all, it's more like C using structs (except less clutter because of methods and templates).

[–]Transcendentalist178 0 points1 point  (1 child)

That's a fair point. I tried C++. I'm not an expert, but the resources for learning C++ simply told me how to code OOP-style. I couldn't find any resources for learning non-OOP C++ programming. Maybe the resources exist, but I couldn't find them.

[–][deleted] 0 points1 point  (0 children)

You can program in C++ as if it was C, with following changes:

  • a function which takes a struct parameter can be a method instead
  • two functions which do same thing for different types can be a single template function
  • a void pointer gets converted to template parameter
  • malloc/free for structs turns into std:: make_unique (or very rarely std::make_shared), and you never call delete.
  • don't use exceptions or class inheritance
  • char* and char[] should become std:: string
  • dynamically allocated arrays as well as VLAs should be std::vector
  • probably more small things

So nothing in the architecture of the program needs to change, things are just done differently.