Serious question here, is C++ just C with classes? If not what else is the difference because I'm learning C now and it seems like the exact same as C++, just with structures instead of classes
Serious question here, is C++ just C with classes...
those are plusses, user
Some C features is deprecated in C++.
>C does not have classes and objects (C does not support OOP)
>Structures in C cannot have functions
>C does not have namespaces (namespaces are used to avoid name collisions).
>The I/O functions are entirely different in C and C++(ex: printf( ), scanf() etc. are part of the C language).
>You cannot overload a function in C (i.e. you cannot have 2 functions with the same name in C).
>Better dynamic memory management operators are available in C++.
>C does not have reference variables (in C++ reference variables are used in functions).
>In C constants are defined as macros (in C++ we can make use of ‘const’ to declare a constant).
>Inline functions are not available in C.
so yeah it's basically C with classes [spoiler]and that's a good thing[/spoiler]
>Structures in C cannot have functions
what are function pointers?
that's encapsulating a pointer, not a function. regardless, what point are you even trying to make?
function pointers
if you put function pointers in structs in C, you're doing C wrong.
should have learned C then C++
it provides a lot of insight on why they added the things they add
saying C++ is just C with Classes(which was it's original name) is an understatement
the things C++ add being good or not is up to debate though
>>Inline functions are not available in C.
what year are you from pal?
C can do conts but it's just a promise to the compiler and the programmer that the data won't be changed
That's all it does
the year of your mom
C++ has templates. Also it standardized a lot of things which C did not such as: threading, filesystem access, timing, garbage collection, and so on.
>imaging being this retarded
>imaging
Also, learn how to use greentext
Oh wow, I made a typo. I digress my argument is as invalid as your retarded opinion about function pointers.
C is basically deprecated outside of unported packages.
Templates, RAII, and closures alone put C++ miles away from C. If you went back to C and thought you were using the same language, you didn't learn C++.
How are 'new' and 'delete' better than 'malloc'/'calloc' and 'free' other than being easier to read for brainlets?
Tbf new and delete also acquire and release other resources, not just memory when called on a class. If you call delete on a class and the class is correctly designed then you can be sure that you are good to go.
severely underrated
fp always bp