Click here to Skip to main content
15,915,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: function to convert char to char* Pin
Christian Graus12-Dec-06 16:45
protectorChristian Graus12-Dec-06 16:45 
QuestionHow to predefine the name of socket in the security blocking? Pin
LaHaHa12-Dec-06 14:25
LaHaHa12-Dec-06 14:25 
QuestionExpressions Pin
BlitzPackage12-Dec-06 14:14
BlitzPackage12-Dec-06 14:14 
AnswerRe: Expressions Pin
Mark Salsbery12-Dec-06 14:20
Mark Salsbery12-Dec-06 14:20 
GeneralRe: Expressions Pin
BlitzPackage12-Dec-06 14:25
BlitzPackage12-Dec-06 14:25 
GeneralRe: Expressions Pin
Mark Salsbery12-Dec-06 14:39
Mark Salsbery12-Dec-06 14:39 
GeneralRe: Expressions Pin
BlitzPackage12-Dec-06 15:59
BlitzPackage12-Dec-06 15:59 
GeneralRe: Expressions Pin
Mark Salsbery12-Dec-06 20:57
Mark Salsbery12-Dec-06 20:57 
BlitzPackage wrote:
Do you know where I can find information on how to do this?


Do which?

I was just mentioning that the implementation of the operator(s) (or any operators) doesn't
need to be a simple inline function. You could do calculations, access a database, whatever it
takes to return a meaningful value of the type cast. If you break the implementation out of
the class declaration, the syntax looks like this:
class CMoneyClass
{
   int m_MyInt;
...
public:
   operator int() const; 
   operator double() const; 
...
};
  
  
CMoneyClass::operator int() const
{
   return m_MyInt;
}
  
CMoneyClass::operator double() const
{
   return (double)m_MyInt;
}

I also added a different casting operator to show how you could have more than one.
Lame example but it works. Smile | :)

Here's a link: C++ Language Reference Cast Operator: ()[^]

Mark
GeneralRe: Expressions Pin
BlitzPackage13-Dec-06 7:28
BlitzPackage13-Dec-06 7:28 
QuestionI would like to have your suggestion! Pin
LaHaHa12-Dec-06 13:57
LaHaHa12-Dec-06 13:57 
AnswerRe: I would like to have your suggestion! Pin
Stephen Hewitt12-Dec-06 14:33
Stephen Hewitt12-Dec-06 14:33 
GeneralRe: I would like to have your suggestion! Pin
LaHaHa12-Dec-06 14:46
LaHaHa12-Dec-06 14:46 
GeneralRe: I would like to have your suggestion! Pin
Stephen Hewitt12-Dec-06 14:51
Stephen Hewitt12-Dec-06 14:51 
GeneralRe: I would like to have your suggestion! Pin
LaHaHa12-Dec-06 15:02
LaHaHa12-Dec-06 15:02 
AnswerRe: I would like to have your suggestion! Pin
Mike O'Neill12-Dec-06 15:11
Mike O'Neill12-Dec-06 15:11 
GeneralRe: I would like to have your suggestion! Pin
LaHaHa12-Dec-06 15:13
LaHaHa12-Dec-06 15:13 
AnswerRe: I would like to have your suggestion! [Modified] Pin
prasad_som12-Dec-06 17:56
prasad_som12-Dec-06 17:56 
GeneralRe: I would like to have your suggestion! [Modified] Pin
LaHaHa20-Dec-06 16:04
LaHaHa20-Dec-06 16:04 
QuestionProgress bar to downloading with WinHttp Pin
Mila02512-Dec-06 12:23
Mila02512-Dec-06 12:23 
AnswerRe: Progress bar to downloading with WinHttp Pin
Ernest Laurentin12-Dec-06 13:21
Ernest Laurentin12-Dec-06 13:21 
QuestionImplementing WM_MENUDRAG & WM_MENUGETOBJECT in menus Pin
benjamin2312-Dec-06 10:49
benjamin2312-Dec-06 10:49 
AnswerRe: Implementing WM_MENUDRAG & WM_MENUGETOBJECT in menus Pin
led mike12-Dec-06 12:21
led mike12-Dec-06 12:21 
GeneralRe: Implementing WM_MENUDRAG & WM_MENUGETOBJECT in menus Pin
benjamin2312-Dec-06 12:50
benjamin2312-Dec-06 12:50 
QuestionCan VC++ launch MS Dos window then issues Dos commands? [modified] Pin
ATC12-Dec-06 10:44
ATC12-Dec-06 10:44 
AnswerRe: Can VC++ launch MS Dos window then issues Dos commands? Pin
Sam Hobbs12-Dec-06 14:25
Sam Hobbs12-Dec-06 14:25 

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.