C++

Quick question In reguards to going from python to c++ I found the change really easy am I doing something wrong? I hear a lot of people on here talking about how hard c++ is but I didn't find it hard at all.

Other urls found in this thread:

courses.cms.caltech.edu/cs11/material/cpp/donnie/
courses.cms.caltech.edu/cs11/material/advcpp/
twitter.com/NSFWRedditGif

Also c++ general thread

It shouldn't be hard

But you probably didn't get to the parts different from Python (memory management, pointers etc.)

Hmm yeah I learned about pointer but not memory's agent anything you'd reccomend me to read?

The C++ Programming Language, 4th ed, by Bjarne himself.
How have you been learning?

By projects and some videos

so I learned C some time back and I want to get into C++. What is the best tutorial out there for those with a decent C background? I don't need to learn from scratch, I essentially want to learn the important differences and the quirks of C++.

Can someone help me wrap my head around what Resource Acquisition Is Initialization (RAII) really is?

personally i went from C to C modular then C++ i think it was a good way to do

#include
using namespace std;

class pointer{
public:

pointer(){

int a = 12;
int b = 5;

int* pointer_to_a(&a);
int* pointer_to_b(&b);

cout

compiled languages aren't that great really. Lots of them will still compile even if the code is wrong.

That's why there are debuggers.

some syntax sugar to help with doing all memory allocations when you declare a variable of any type
This is so you dont manually allocate raw memory as often so that you have fewer things to remember to free
Not sure exactly in syntax this means, but i believe that is the general concept

The reference material in www.cplusplus.com should be enough to get you up to speed with basic C++ if you already know C. It also has a standard library reference that is a blessing

Catching most errors > catching nothing until run time

courses.cms.caltech.edu/cs11/material/cpp/donnie/
courses.cms.caltech.edu/cs11/material/advcpp/

Great way to work through it yourself

did you get the templates and pointers ?
if so congratz, gg, ez

And btw I did the reverse thing, even better.
From C++ to Python (yeppers, higher salary) in a week.

Python is so much more elegant in many ways :)

Yeah thanks k don't really get when you would use templates

everytime you can

Explain when to use them

When you can use this function / class with different type of variable.

Example:
You want to go through a tab, but not necessarily a vector (STD:: list...).

You can use a template here

templates are "variables" that only exist at compile time and hold a type. so for example, you could write a template function that sorts a vector of unknown type , and then instantiate that sort template for integers, floats, etc. that is, =

this is totally distinct from inheritance polymorphism, where you write a function that operates on only ONE type (the base class or "interface"), and then apply that one function exclusively to types that inherit from that base

because templates provide variables at compile time, they are expressive enough to write arbitrary programs, and you can write a compile-time program that generates the code for your run-time program. this is extremely advanced, but it's not irrelevant -- the standard library uses it extensively.

this is the main reason that C++ is hard, along with memory management

Not OP but could you please share pdf? Can't find it on the interwebs, only 3rd ed. Is 3rd good/updated enough?

>found the change really easy
>don't really get when you would use templates
So basically, you don't know C++ at all. Suspicions confirmed.