Brian is saying that. In C++,
this is an assignment: a=1
while this is a comparison: a==1
What's also neat in C++ (and a pain
) is that an assignment returns the value of the assignment:
if(( a=1 )==1){ Will be true }
that means first in the parenthesis, the ASSIGNING of "a" by putting a "1" in it... is like a function returning "1".. which is why the == thing (comparison) will be true.
Now Brian is saying where you might of thought you were testing:
if(a=1){ do something }
you actually were assigning a value instead of comparing it against something else. So...
if(a=1)
is the same as
if(1)
with the side effect that "a" now has a value if "1" in it!!! It's both CONFUSING and super powerful! Now if only C++ had the testing capabilities of FreePascal... FreePascal guarantees that and if statement STOPS being processed once a condition of false is met. C++ I think processes the whole IF statement but I'm digressing.
Ok... NOW on to what I was asxking about. Now, I have a saying I use:
Know way to many languages, master of none so I might be wrong here because I haven't been hitting C++ hard lately.. but I think like javascript you need to call functions with parenthesis even when there aren't parameters:
dbShowObject; <---- BAD (unless you want the address of the function and I don't think you are at that level of crazyness yet)
dbShowObject(); <---- Much better - you are at least calling the function... however I though with dbShowObject you have to pass the ID of the object.. but I forget...
I hope my 11pm ramblings are somewhat helpful to ya... and if they are not, there is
http://www.cplusplus.com/ the tutorials there helped me greatly when I finally decided to hit C++ hard... You have to force yourself to understand the low level junk first - then things start to click when you come back to DarkGDK - I Promise!