Thread: casting
View Single Post
Join Date: Dec 2008
Posts: 109
Reputation: winrawr is an unknown quantity at this point 
Solved Threads: 1
winrawr's Avatar
winrawr winrawr is offline Offline
Junior Poster

Re: casting

 
0
  #4
Jan 11th, 2009
what's the difference between an explicit conversion and an implicit conversion?
By what means can a class "Support" a direct conversion? Does this mean I couldn't go if(a string==a char*){ , but I could still cast it? or could I cast it?
I think what I'm asking is (I'm just trying to understand how data-types work in C++) if I wrote a class, how would I deal with what it can and can't be converted to?

Also, what does string::c_str() do? Is it just a function that returns a const char*?

Thanks for your help so far btw... I'm starting to understand a lot more about this


oh, what WOULD happen if you casted a float to an int? Just lose the decimal places? Or a signed to unsigned or vice versa?
I wake up! And my mind's out, never again will I sell out. Converting vegetarians.
Into the midnight giving it to you, I don't know it just feels right.
This is the time of the revolution, Cooking the next step.
Converting vegetarians, minding the gap since 1996
Reply With Quote