Tag Archives: pointers

Making a copy of constructor arguments in C++

Okay, maybe my C++ is getting rusty, but I’m stammering at coming up with a reasonable solution to this problem: Imagine a class, like this one: class Foo { public: Foo(string &name) : name_(name.c_str()) { } private: char *name_; } … Continue reading

Posted in General | Tagged , , , , | 5 Comments

Is there a space after the *, or after the &?

No, there is not a space after the *. Take a look at this example: value = *pointer; Note how there’s not a space after the asterisk. Also note how the type of “value” and the type of “*pointer” are … Continue reading

Posted in General | Tagged , , , , | 2 Comments