Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
NewsHow to provide a Security to a proprietary software or presemtation. Pin
Member 1278313512-Oct-16 20:03
Member 1278313512-Oct-16 20:03 
GeneralRe: How to provide a Security to a proprietary software or presemtation. Pin
jeron113-Oct-16 4:15
jeron113-Oct-16 4:15 
GeneralRe: How to provide a Security to a proprietary software or presemtation. Pin
leon de boer13-Oct-16 8:17
leon de boer13-Oct-16 8:17 
Questionclass is missing "type" - why ? Pin
Vaclav_12-Oct-16 15:00
Vaclav_12-Oct-16 15:00 
AnswerRe: class is missing "type" - why ? PinPopular
leon de boer12-Oct-16 17:45
leon de boer12-Oct-16 17:45 
AnswerRe: class is missing "type" - why ? Pin
Graham Breach12-Oct-16 23:11
Graham Breach12-Oct-16 23:11 
QuestionObject Creation of an class? Pin
Mathan_CodeProject11-Oct-16 5:17
Mathan_CodeProject11-Oct-16 5:17 
AnsweralternatRe: Object Creation of an class? Pin
leon de boer11-Oct-16 5:50
leon de boer11-Oct-16 5:50 
GeneralRe: alternatRe: Object Creation of an class? Pin
Mathan_CodeProject11-Oct-16 23:02
Mathan_CodeProject11-Oct-16 23:02 
AnswerRe: Object Creation of an class? Pin
Krishnakumartg11-Oct-16 19:46
Krishnakumartg11-Oct-16 19:46 
GeneralRe: Object Creation of an class? Pin
Mathan_CodeProject11-Oct-16 23:01
Mathan_CodeProject11-Oct-16 23:01 
AnswerRe: Object Creation of an class? Pin
Midi_Mick11-Oct-16 22:13
professionalMidi_Mick11-Oct-16 22:13 
GeneralRe: Object Creation of an class? Pin
Mathan_CodeProject11-Oct-16 23:01
Mathan_CodeProject11-Oct-16 23:01 
QuestionC++ syntax Pin
Ratul Thakur10-Oct-16 21:35
Ratul Thakur10-Oct-16 21:35 
AnswerRe: C++ syntax Pin
CPallini10-Oct-16 21:49
mveCPallini10-Oct-16 21:49 
AnswerRe: C++ syntax Pin
Richard MacCutchan10-Oct-16 21:50
mveRichard MacCutchan10-Oct-16 21:50 
AnswerRe: C++ syntax Pin
David Crow11-Oct-16 6:20
David Crow11-Oct-16 6:20 
QuestionOne more error using function pointers - void value not ignored as it ought to be Pin
Vaclav_9-Oct-16 6:18
Vaclav_9-Oct-16 6:18 
AnswerRe: One more error using function pointers - void value not ignored as it ought to be Pin
Richard MacCutchan9-Oct-16 6:36
mveRichard MacCutchan9-Oct-16 6:36 
GeneralRe: One more error using function pointers - void value not ignored as it ought to be Pin
Vaclav_9-Oct-16 7:53
Vaclav_9-Oct-16 7:53 
GeneralRe: One more error using function pointers - void value not ignored as it ought to be Pin
leon de boer9-Oct-16 23:11
leon de boer9-Oct-16 23:11 
AnswerRe: One more error using function pointers - void value not ignored as it ought to be Pin
leon de boer9-Oct-16 21:42
leon de boer9-Oct-16 21:42 
Sorry to butt in but your problem has nothing to do with classes or inheriting it's just code syntax that would not work anywhere.

Lets review function pointers ..
1.) you can set then to a function using the "&" symbol
2.) you can transfer the value to another function pointer that matches.

Can I suggest you first try and write just two function pointers in normal C++ and try to set them ... here let me write the code for you
 void someFunc (char* text){
     // .... some code in here
}

// Here are our two function pointers
void(*FunctionPointer_A)(char *);
void(*FunctionPointer_B)(char *);

// You can set either of them to the function using the & symbol .. item 1 use of function pointers
FunctionPointer_A = &someFunc;
FunctionPointer_B = &someFunc;

// Or you can set one and copy the other which is item 1 then item 2 use of function pointers
FunctionPointer_A = &someFunc;
FunctionPointer_B = FunctionPointer_A ;

I think this later is what you are attempting to do and if you copy the code in you should find it happily compiles.

Forgetting the class prefix this what you typed is nonsense .. it doesn't meet either of the item 1 or 2 formats
FunctionPointer_B = Process_INHERITANCE_A( Text);


After Richards suggestion you at least seem to get the function pointer setting
FunctionPointer_B = &INHERITANCE_A::Process_INHERITANCE_A;

That I can at least I can understand and is ever so close but now we come details of a class.

Any class function has a hidden self pointer pushed down on the function call. You don't see it the C++
compiler hides the syntax from you. So basically your function pointer doesnt equal the actual function
of a class function .. that is what the compiler is complaining about.

Your function pointer B needs to reflect its a class member function pointer .. not a function pointer to a static code
redefine it to
void(INHERITANCE_A::*FunctionPointer_B)(char *);

You may also need to typedef this if you want to carry the function as a forward declaration

All that is really happening is the function pointer knows to push the class self pointer down before it calls but from
your perspective it makes the compiler see the two as the same type.

There are better ways to do the function pointer assignment for classes, the magic term to do a search for is
memberfunctionpointer. Because you are trying to make a function pointer to a member function in a class.
Try:Member Function Pointers and the Fastest Possible C++ Delegates[^]
In vino veritas


modified 10-Oct-16 4:57am.

GeneralRe: One more error using function pointers - void value not ignored as it ought to be Pin
Richard MacCutchan9-Oct-16 21:49
mveRichard MacCutchan9-Oct-16 21:49 
GeneralRe: One more error using function pointers - void value not ignored as it ought to be Pin
leon de boer9-Oct-16 23:23
leon de boer9-Oct-16 23:23 
GeneralRe: One more error using function pointers - void value not ignored as it ought to be Pin
Richard MacCutchan9-Oct-16 23:25
mveRichard MacCutchan9-Oct-16 23: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.