Why C++ is Better than C Language

5
2



Can you tell me why C++ is better than C language? And not just because of the double pluses, please.

C++ is often considered better just because it has classes that are the basis of object oriented programming.

I know Java is object oriented programming, though all the errors and updates it gives me don’t make me think it is very good.

Java and other object oriented programming languages have the benefit of code re-use. And modular programming, which is easier to debug than functional programming.

However, C is often taught as the first programming language.

If you can master C, you can write anything from server applications to drivers to web apps. And you’ll learn C++ a whole lot faster, because the vocabulary is the same, with just the classes and objects added.

That’s like saying that you’ve learned English, go master these hard vocabulary terms and odd regional parts of speech.

You mean phrases. C++ in some ways is easier because it doesn’t require you to learn the low level commands.

But then there are all the pointers and raw arrays. And there is pointer arithmetic, which is about as painful as Common Core math but without partial credit for explaining how you were thinking about it.

Compared to C# and the dot-net framework, much less working with Microsoft servers, C++ is easy.

C++ has off by one errors.

That’s not just an issue in C++, and you can solve it with iterators for the off by one errors.

I think we’re getting off the topic.

A lot of the hesitation about C++ is that it is C with classes and OOP. But the fact that is both gives you the flexibility and universality of C with the supportability of OOP.

Is supportability a word?

Yes. I think some people struggle to learn C++ because it has so many features that they don’t master them all, whereas simpler, limited languages are easy to master but tie you up in knots try to use it for problems to which they aren’t suited.

And what is C++ suited for?

Almost everything, including internet applications C cannot handle.

Nguồn:https://wijstaanvooronzegrondrechten.org/

5 COMMENTS

  1. 1. If you want to have classes, tying state to functionality, then you can do that in C too. Simply export the declaration of a pointer to your struct, but not the declaration of your struct. The pointer to your struct is then passed as an argument to every function of the object allowing you to modify the content as if it were private variables.

    2. If you want to have interfaces, then you can always work with function pointers. Interfaces are simply scripts that require you to pass in subroutines for completeness. Why not pass them via the header?

    3. If you want to have inheritance… then go on… Once you hit the brickwall you will understand.

    Imho the ONLY advantage of C++ is templating. But even C++ templates are a shitty solution. A less C strongly typed would be the ideal solution. Most of the Macro hacks are there to get around the typing system, and they don't make the Code more readable.

LEAVE A REPLY

Please enter your comment!
Please enter your name here