Ok, I did not understand it.
The function, which returns a stellarobject& is only really needed when you want that ++(++obj) returns a 2, that's the case which Elysia described, right?
...
Type: Posts; User: Chris L. Tailor
Ok, I did not understand it.
The function, which returns a stellarobject& is only really needed when you want that ++(++obj) returns a 2, that's the case which Elysia described, right?
...
Well, I understand the implementation, I just wonder why this
void increment(){ id++; }
and, for instance, this
stellarobject operator++(){
So to put it all in a nutshell:
In the average case id++ is equal to id = id+1
Inside the operation overload function a++ means something totally different,
stellarobject operator++(){
Ah now I see, without the & it just returns twice a copy of stellarobject incremented by one, while the other one with the & updates itself twice and gets the 2.
There's just one thing that ...
Ah, I think I understand now, but even when I leave out the & after stellarobject the method increments the stellarobject, so in this case, it doesn't make a difference?
I think, I should precise my question:
I know what a reference is, but (I know what &stellarobject means) stellarobject& , why can you write it after the data type?
And &stellarobject and...
I have a another question, is there a difference between
stellarobjekt operator++(){ //Durch das braucht man keine Temporärvariable, sondern weist die Änderung direkt dem betreffenden ...
I am using MinGW 4.7.2.
So I tried it out with the Cygwin Compiler and everything works fine. In conclusion, it is an issue with MinGW.
The problem isn't just the syntax highlighting, the compiler doesn't seem to understand operator+, it thinks of it as a normal method I think.
There are no errors, the programm just gives out the...
That feeling when operator overloading is broken in mingw/g++...
Thank you all for the many responses.
Well, the author used that C/C++ hybrid style, no idea why he did it, but I'll stick to C++ from now on.
Got another issue regarding overloading operators,...
I think I understand now, in your second example, the pointer is not updated, because you just change the value of the local pointer, by giving it the value of the x, but it doesn't affect the...
So you are saying that
void main{
int *pointer = NULL;
function (&pointer);
return 0;
}
If I leave out the & when transfering pstart and leaving out one *, I am basically just sending the adress, I thought?
The adress is all it needs to update itself with pliste? The IDE also gives...
Hey guys,
I have programmed a tree structure with the help of my C++ book and was wondering about the usage of double pointers by the author.
Here's the code:
#include <iostream>