I have a few questions, that google and my current book just can't seem to answer, so I was hoping maybe someone could. :)
When using the #define macro, can you return anything not from the last expression?
When you have a class that has a pointer to memory that is allocated at run time (new), other than the destructor is there any other member methods and operators that I will need?
I understand what the keyword explicit does, but how does it help by preventing unwanted conversions?
The major thing I'm confused on it how to use a friend function, although I've done my fair share of googling and reading in general on it, I'm still a bit confused on how to actually use it.
When using the #define macro, can you return anything not from the last expression?
I'm not 100% sure what you're asking here.
DentyneIce wrote:
When you have a class that has a pointer to memory that is allocated at run time (new), other than the destructor is there any other member methods and operators that I will need?
You could overload the delete[ ]/delete operators. If you do decide to do this, make sure you read about it.
DentyneIce wrote:
I understand what the keyword explicit does, but how does it help by preventing unwanted conversions?
If you know what the explicit keyword does, you wouldn't be asking this question. I'll answer it anyway. explicit basically forces you to pass the correct arguments to a constructor (unless you explicitly cast that argument). Maybe MSDN[1] could shed some light on your question.
For the last one.. IF you can get your hands on "The Object-Oriented thought proccess" then i highly recommend it! Helped me a lot from transitioning to OO programming..
BUT!..
Friend functions are declared in the class itself. although they can be used OUTSIDE of the class, just having access to the class private and protected members
@Framework: What I mean by the last question was if using explicit helps prevent errors or optimize the performance of the program or..? Sorry for not explaining myself better.
@strongdrink: Thanks!
DentyneIce, It doesn't necessarily prevent errors but it does prevent the compiler from converting the given data so it fits the arguments type-specifier; so I guess it optimizes the program in a small (and potentially minute) way.
I found that msdn article helpful to me to thanks. i didnt know that the constructors would and can do an implicit conversion. I thought anything other then what was requested was passed it would spit a warning at the very least and on a good day not compile if you tried. apparently i was wrong.