Click here to Skip to main content
15,919,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
sahoong19-Oct-06 9:19
sahoong19-Oct-06 9:19 
GeneralRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
Zac Howland19-Oct-06 9:37
Zac Howland19-Oct-06 9:37 
GeneralRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
sahoong24-Oct-06 10:08
sahoong24-Oct-06 10:08 
AnswerRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
Mike Dimmick19-Oct-06 6:58
Mike Dimmick19-Oct-06 6:58 
GeneralRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
sahoong19-Oct-06 8:07
sahoong19-Oct-06 8:07 
AnswerRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
Zac Howland19-Oct-06 8:08
Zac Howland19-Oct-06 8:08 
AnswerRe: ILLEGAL INDIRECTION - HOW CAN IT BE RESOLVED? Pin
David Crow19-Oct-06 8:35
David Crow19-Oct-06 8:35 
Questionhelp on type conversion operator overloading error... Pin
2simple19-Oct-06 5:50
2simple19-Oct-06 5:50 
as title. The code and the error messages are posted as follows. VS2005 + wtl. I checked some articles and references on polymorphism and operator overload, but haven't figured out the problems. So why it's wrong? How to correct it? Thanks in advance.

Basically the classes are used to query values (can be interpreted to different built-in types e.g. dword, char*, etc.) according to key.

Code: (you can copy it into your VC++ compiler and try)
-----

#include "stdafx.h" // wtl required

class ObjValue
{
};

class ObjKey
{
public:
class ObjValueProxy {
public:
ObjValue QueryValue() const;
operator ObjValue() const;
};
};

ObjValue ObjKey::ObjValueProxy::QueryValue() const
{
ObjValue* v = new ObjValue;
return *v;
// i don't care the value in this example
// in reality, it's the result of some query action
}

operator ObjKey::ObjValueProxy::ObjValue() const
{
return QueryValue();
}

Errors:
------

Compiling...
testoperatoroverloading.cpp
d:\test\testoperatoroverloading.cpp(25) : error C2039: 'ObjValue' : is not a member of 'ObjKey::ObjValueProxy'
d:\test\testoperatoroverloading.cpp(10) : see declaration of 'ObjKey::ObjValueProxy'
d:\test\testoperatoroverloading.cpp(26) : error C2270: '.?AVObjValue@@' : modifiers not allowed on nonmember functions
d:\test\testoperatoroverloading.cpp(26) : error C2801: 'operator ObjValue' must be a non-static member
d:\test\testoperatoroverloading.cpp(27) : error C3861: 'QueryValue': identifier not found
test - 4 error(s), 0 warning(s)
AnswerRe: help on type conversion operator overloading error... Pin
Mark Salsbery19-Oct-06 6:23
Mark Salsbery19-Oct-06 6:23 
GeneralRe: help on type conversion operator overloading error... Pin
2simple19-Oct-06 6:44
2simple19-Oct-06 6:44 
GeneralRe: help on type conversion operator overloading error... Pin
Mark Salsbery19-Oct-06 6:59
Mark Salsbery19-Oct-06 6:59 
QuestionIssues with Windows Explorer & wnetaddconnection2 Pin
fred shaw19-Oct-06 4:51
fred shaw19-Oct-06 4:51 
QuestionRe: Issues with Windows Explorer & wnetaddconnection2 Pin
David Crow19-Oct-06 4:54
David Crow19-Oct-06 4:54 
AnswerRe: Issues with Windows Explorer & wnetaddconnection2 Pin
fred shaw24-Oct-06 1:22
fred shaw24-Oct-06 1:22 
Questionwindow sizing (again) Pin
Waldermort19-Oct-06 4:39
Waldermort19-Oct-06 4:39 
AnswerRe: window sizing (again) Pin
Mark Salsbery19-Oct-06 6:53
Mark Salsbery19-Oct-06 6:53 
GeneralRe: window sizing (again) Pin
Waldermort19-Oct-06 18:23
Waldermort19-Oct-06 18:23 
GeneralRe: window sizing (again) Pin
Mark Salsbery21-Oct-06 11:52
Mark Salsbery21-Oct-06 11:52 
QuestionHow to do Automation in MFC for Microsoft Access? Pin
sujeet_kulk19-Oct-06 4:03
sujeet_kulk19-Oct-06 4:03 
QuestionRe: How to do Automation in MFC for Microsoft Access? Pin
David Crow19-Oct-06 4:20
David Crow19-Oct-06 4:20 
GeneralRe: How to do Automation in MFC for Microsoft Access? Pin
sujeet_kulk19-Oct-06 4:32
sujeet_kulk19-Oct-06 4:32 
GeneralRe: How to do Automation in MFC for Microsoft Access? Pin
David Crow19-Oct-06 4:50
David Crow19-Oct-06 4:50 
GeneralRe: How to do Automation in MFC for Microsoft Access? Pin
sujeet_kulk19-Oct-06 5:02
sujeet_kulk19-Oct-06 5:02 
GeneralRe: How to do Automation in MFC for Microsoft Access? Pin
David Crow19-Oct-06 5:17
David Crow19-Oct-06 5:17 
GeneralRe: How to do Automation in MFC for Microsoft Access? Pin
sujeet_kulk19-Oct-06 5:29
sujeet_kulk19-Oct-06 5:29 

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.