Zegg90
12-08-2006, 09:17 PM
I have a few questions that probably have very simply answers :P
I am learning C++, and it's easy in some aspects but in others I am very confused...
1. I've seen some object examples, but what's the difference between these two:
Object1.Function();
Object1->Function();
Is the dot used or the arrow used? For both functions and variables?
2. How are pointers used in functions?
I've seen Get() functions that take information from the class, and they require a pointer to set the retrieved value to the pointer.
But the Set() function just needs a normal variable, and not a pointer...
This is the code:
BOOL Get(DWORD *Var) { *Var = m_dwCount; return TRUE; }
BOOL Set(DWORD Var) { m_dwCount = Var; return TRUE; }
Why a pointer in one function, but not in the other?
That's about it for me at the moment :P
Thanks!
I am learning C++, and it's easy in some aspects but in others I am very confused...
1. I've seen some object examples, but what's the difference between these two:
Object1.Function();
Object1->Function();
Is the dot used or the arrow used? For both functions and variables?
2. How are pointers used in functions?
I've seen Get() functions that take information from the class, and they require a pointer to set the retrieved value to the pointer.
But the Set() function just needs a normal variable, and not a pointer...
This is the code:
BOOL Get(DWORD *Var) { *Var = m_dwCount; return TRUE; }
BOOL Set(DWORD Var) { m_dwCount = Var; return TRUE; }
Why a pointer in one function, but not in the other?
That's about it for me at the moment :P
Thanks!