Didn't get: Casting.
One minute response: Try thinking about the type of the values in your program, and notice when two associated values are different.
Didn't get: Syntax for casting.
One minute response: The syntax (for new-style casts, anyway) is just like specialized template functions..
Didn't get: Was very confusing.
One minute response: And just think: it's going on every time you write a program.
Didn't get: User defined operator conversions.
One minute response: The allow you to go from a class value to something else; avoid them in favor of member functions.
Didn't get: The thing which is difficult to understand is then I do coding, which kind of cast I can use.
One minute response: For the most part, stick with static casts (when you need to; the compiler will be "helping" you here). Most people don't use the const
(or volatile
) keywords, so there's no need to use const casts. You probably won't be writing code that needs reinterpretation casts, and dynamic casting is covered better by virtual member functions.
Didn't get: Reinterpretation cast < > (I feel it is difficult).
One minute response: And it is, but as long as you don't (ab)use pointers or references, you needn't worry about it..
This page last modified on 25 March 2003.