Click here to Skip to main content
16,010,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: conversion operator ??? Plz help ......... Pin
led mike9-Aug-07 8:08
led mike9-Aug-07 8:08 
GeneralRe: conversion operator ??? Plz help ......... Pin
Zealous_Me9-Aug-07 8:32
Zealous_Me9-Aug-07 8:32 
GeneralRe: conversion operator ??? Plz help ......... Pin
led mike9-Aug-07 9:08
led mike9-Aug-07 9:08 
GeneralRe: conversion operator ??? Plz help ......... Pin
Zealous_Me10-Aug-07 8:57
Zealous_Me10-Aug-07 8:57 
GeneralGood luck in the future! Pin
leckey9-Aug-07 9:48
leckey9-Aug-07 9:48 
GeneralRe: Good luck in the future! Pin
Zealous_Me10-Aug-07 8:55
Zealous_Me10-Aug-07 8:55 
GeneralRe: conversion operator ??? Plz help ......... Pin
jhwurmbach9-Aug-07 22:43
jhwurmbach9-Aug-07 22:43 
AnswerRe: conversion operator ??? Plz help ......... Pin
Mark Salsbery9-Aug-07 8:33
Mark Salsbery9-Aug-07 8:33 
Conversion functions provide a way to explicitly convert an object of a type to another type.

Zealous_Me wrote:
Why it is created with overloading keyword "operator" ?

Probably because conversions are done using a "casting operator" - parenthesis "()"

Zealous_Me wrote:
Why it does not have a return type, while with the "operator" keywork we have to have mention a return type ????

This is a matter of the chosen syntax.  Bjarne would know best, but I imagine the syntax is this way to differentiate the
conversion function from a function call operator.

For example, the syntax could have been chosen to be

type operator()

but a function call operator looks like this:

type operator()([optional arguments])

Having the syntax for a conversion function like this:

operator type()

seems more clear to me that it's a "cast operator" to "type".

As led mike suggested, reading is good -Operator Overloading[^]

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: conversion operator ??? Plz help ......... Pin
led mike9-Aug-07 9:08
led mike9-Aug-07 9:08 
GeneralRe: conversion operator ??? Plz help ......... Pin
Mark Salsbery9-Aug-07 9:15
Mark Salsbery9-Aug-07 9:15 
AnswerRe: conversion operator ??? Plz help ......... Pin
Russell'9-Aug-07 8:35
Russell'9-Aug-07 8:35 
QuestionRE: adding a button in a application Pin
itsgood1239-Aug-07 5:11
itsgood1239-Aug-07 5:11 
AnswerRe: RE: adding a button in a application Pin
toxcct9-Aug-07 5:12
toxcct9-Aug-07 5:12 
QuestionRe: RE: adding a button in a application Pin
David Crow9-Aug-07 5:30
David Crow9-Aug-07 5:30 
AnswerRe: RE: adding a button in a application Pin
itsgood1239-Aug-07 11:28
itsgood1239-Aug-07 11:28 
QuestionRe: RE: adding a button in a application Pin
David Crow10-Aug-07 2:52
David Crow10-Aug-07 2:52 
AnswerRe: RE: adding a button in a application Pin
itsgood12310-Aug-07 3:51
itsgood12310-Aug-07 3:51 
GeneralRe: RE: adding a button in a application Pin
David Crow10-Aug-07 4:02
David Crow10-Aug-07 4:02 
GeneralRe: RE: adding a button in a application Pin
itsgood12314-Aug-07 11:11
itsgood12314-Aug-07 11:11 
GeneralRe: RE: adding a button in a application Pin
David Crow15-Aug-07 2:42
David Crow15-Aug-07 2:42 
QuestionRe: RE: adding a button in a application Pin
David Crow15-Aug-07 3:40
David Crow15-Aug-07 3:40 
AnswerRe: RE: adding a button in a application Pin
itsgood12315-Aug-07 5:53
itsgood12315-Aug-07 5:53 
QuestionRe: RE: adding a button in a application Pin
David Crow15-Aug-07 6:08
David Crow15-Aug-07 6:08 
AnswerRe: RE: adding a button in a application Pin
itsgood12315-Aug-07 8:05
itsgood12315-Aug-07 8:05 
QuestionRe: RE: adding a button in a application Pin
David Crow15-Aug-07 8:19
David Crow15-Aug-07 8:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.