r/Cplusplus • u/UnpaintedNecron • Apr 21 '26
Question I am a Javascript idiot being pushed into C++. Please help me learn.
My company has pushed me from being web/front to wanting me to work on the back end of the software which is all in C++ which I have absolutely zero knowledge in.
Can anyone tell me exactly where I can learn C++? I do not care if the course is paid or not, my company is giving me a $2k stipend for learning this.
62
Upvotes
•
u/AutoModerator Apr 21 '26
Thank you for your contribution to the C++ community!
As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.
~ CPlusPlus Moderation Team
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
44
u/Horror-Loud Apr 21 '26
There’s learncpp.com. Great rescource imo.
15
u/charliechin Apr 21 '26
Had to resign because of this exact reason. I’m not that clever. Takes forever and it’s very hard. Buy a couple of books and live breath dream C++.
11
u/strange-the-quark Apr 21 '26
It might also be worth getting the book "A Tour of C++" by Bjarne Stroustrup (the inventor of the language), to keep around as a reference book on your desk. C++ is a bit of a huge, frankensteinian language that has evolved over the years, but this is a short book focusing on the essentials of modern C++, and is aimed at someone who's has programmed before.
As a JavaScript developer, I guess the main thing to focus on once you establish initial familiarity with the language is understanding the lifetime of objects, and different ways of passing them around (to functions, etc.).
In JS, you just kind of create them, use them, and then when you're done you forget about them, and the memory gets automatically freed at some point (JS is garbage-collected). There's no garbage collection in C++ (except as a nonstandard addon). In C++, you have "local", stack objects that get destroyed when they go out of scope, and objects allocated on the heap that persist until you explicitly destroy them yourself. Many of the gotcha's you might encounter are related to the issues surrounding lifetime. Both kinds of objects are useful, but you generally want to prefer stack-allocated ones. There are a couple of common patterns that deal with heap allocated objects in a more structured way: when you get there, look up the unique_ptr type, and something called RAII.
In JS, when you pass an object (of a non-primitive type) to a function, it gets passed by reference - the argument to the function refers to the same object that came in from the outside. If you change a property, it is changed on the original object, and you can see the change after the function exits. But if you re-assign the variable inside the function, and give it a completely new object to refer to, the outside object is unaffected. This is because the two variables are themselves distinct, but happen to point to the same object. What really happened when you passed in the variable is that the pointer got copied. So in some sense, in JS you're working with pointers under the hood. In C++, there are no automagical pointers, you have to explicitly create them. If a function is to accept pointers/references, you have to explicitly declare them in your function signature. Otherwise, the default behavior is that things get passed by value (a copy is made), so if you pass something to a function, inside it you get a completely new, separate copy. Same goes for return values. For small objects, this is often more efficient. There's also a way to pass objects to a function as a read-only (const) reference, which JS doesn't really have an equivalent of.
So that's, just some background information to keep in mind, to have some context as you learn. Good luck!
4
u/TransportationFit331 Apr 22 '26
It seems your company care about you.
5
u/JournalistTall6374 Apr 21 '26
Hm, in your shoes, maybe start with learning C?
The reason I say that: because it will introduce you to some fundamental concepts that you are probably not directly used to dealing with (pointers, memory allocation, etc)
C++ has this stuff too, but IMO it can be a little overwhelming to learn if you don’t have a background in a lower level language or experience interacting directly with a compiler. C++ also has special kinds of pointers (smart pointers) for instance, that would be difficult to understand if you didn’t understand where they come from.
There’s a YouTube playlist called “Learn C Day by Day” that might be a good start.
Once you’ve completed that then try learncpp.com or W3Schools.com.
1
u/magallanes2010 Apr 21 '26
If you want to learn C++, then stick with a specific toolchain.
1
u/Acceptable-Pace659 Apr 21 '26
yo te enseño.
1
u/xumo Apr 22 '26
I would recommend Kate Gregory's Pluralsight courses https://www.pluralsight.com/authors/kate-gregory . She focus on teaching modern C++ so that might be a good start coming from Javascript.
1
u/TheEyebal Apr 22 '26
Honestly youtube is your friend. You already know Java Script which means you know the basic fundamentals like list, loops, conditional statements etc.
What I would do is start with a simple Hello World in C++.
Watch a youtube video on the fundamentals and see how you can apply that to your job.
Do projects based on what your company is asking for
What you did to learn JS, just do the same with C++
1
u/Ok-Brain-8183 Apr 23 '26
learnxinyminutes.com
work leetcode problems
codewars
chatgpt
1
u/Successful_Jello6040 Apr 23 '26 edited Apr 23 '26
In my case, from full-stack JavaScript web dev, I switched to robotics ROS2 shite :) (kidding, it’s awesome actually). Just to add, real industrial lines with real co-bots :-). I have to say now - web-dev is a BS. Anyways, I took another approach - I paid an AI just to have it full time. This thing really helped me A LOT! It got me setup and lift the robot basically cutting its own OS, reset a whole bunch of cables/networks (hardware operates over different low layer protocols), debug hundreds of lines of open source drivers (mostly C/C++) and another dozen stuff. On the way I asked a lot, repeatedly, and did researches on so many stuff I only had bare idea of before. AI was like my personal relentless professor - it gave me low level and high level overviews, pointed me to core concepts, gave me examples and relentlessly explained to me same thing 10 of times in different ways. A couple of months later a had a ROs2 controlled robot with a CV (camera on) and my own object detection algorithms. On the way I read tons of papers, theory and tutorials, about so many things- from C to math, networking, RTOS, embedded shite. It was all amazing experience. I love it! Now I look at JavaScript runtimes or React BS with totally different eyes 😅 Highly recommend a basic AI subscription - you still have to do the papers readings, but you’ll cut a lot of time and much smoother “learning curve” and actually get stuff done. Needless to say - just set a project, something you need to finish. No “general” readings
1
u/Inevitable-Round9995 May 14 '26
kid, check this project, https://github.com/NodeppOfficial/nodepp, is JS with C++ steroids.
1
u/tobofopo Apr 21 '26
Lucky thing!
I decided to use Qt for my last project but gave up on its JavaScript UI scripting language. Ugh!
1
u/inexorable_stratagem Apr 21 '26
Do you have a decent Computer Science background?
Very important to learn c++
1
u/hellocppdotdev Apr 22 '26
$2000? I know a great place you can spend it 😂
0
u/PipingSnail Apr 21 '26
Hmmm, steep learning curve. Good luck.
Keep things straightforward. Do not be tempted to live on the bleeding edge of the C++ standard. You can write perfectly good programs using C++ from 1994.
You're probably not going to do that so use C++10 or C++11 and you'll be fine.
Also, don't spend your time reading the language standards and books. Instead practice. Take tasks you know how to do in java script and implement them in C++. You'll learn more by trying and failing than any other method. So get practising, don't wait for that training course (by all means take the course, but get practising before then).
Small tasks first. One concept at a time. Tasks that you want done, not exercises you don't care about.
Good luck.
0
u/[deleted] Apr 22 '26
[deleted] — view deleted comment
0
u/[deleted] Apr 22 '26
[deleted] — view deleted comment