Basics of type casting in c++