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

C / C++ / MFC

 
QuestionSplit CString Pin
kumar sanghvi22-Dec-09 18:33
kumar sanghvi22-Dec-09 18:33 
AnswerRe: Split CString [modified] Pin
Rajesh R Subramanian22-Dec-09 18:51
professionalRajesh R Subramanian22-Dec-09 18:51 
RantRe: Split CString Pin
Adam Roderick J22-Dec-09 21:51
Adam Roderick J22-Dec-09 21:51 
GeneralRe: Split CString Pin
Rajesh R Subramanian22-Dec-09 23:17
professionalRajesh R Subramanian22-Dec-09 23:17 
AnswerRe: Split CString Pin
KingsGambit22-Dec-09 19:02
KingsGambit22-Dec-09 19:02 
Question/MTd' and '/clr' command-line options are incompatible Pin
Anu_Bala22-Dec-09 18:33
Anu_Bala22-Dec-09 18:33 
AnswerRe: /MTd' and '/clr' command-line options are incompatible Pin
KingsGambit22-Dec-09 19:08
KingsGambit22-Dec-09 19:08 
Questionfunction access in base and derived classes Pin
JudyL_MD22-Dec-09 8:44
JudyL_MD22-Dec-09 8:44 
I've got a problem trying to define / restrict function accessibility in C++ classes. I'm using the VS2008 compiler, since that does make a difference -- there's a solution using a friend helper class that worked prior to VS2005 but doesn't any more since MS fixed a bunch of conformity error in the later compilers.

I have a base class, an asynchronous callback coming from the OS, and a derived class. The async callback needs to manipulate some of the private variables in the base class. The derived class must NOT be allowed to manipulate those variables and, as such, cannot be allowed to call the function that does so.

My question is how do I modify the following code snippets to do what I want. Don't worry about re-entrancy issues with the callback - that's been removed for the sake of clarity.

baseclass.h
class BaseClass
{
public:
    BaseClass ();
    void BaseFuncA ();

private:
    // various member functions and variables
    void CallbackFuncA ();
};
baseclass.cpp
void CALLBACK AsyncCallbackFunc (DWORD dwParam)
{
    ((BaseClass *) dwParam)->CallbackFuncA ();
}

void BaseClass::BaseClass ()
{
    // init OS func passing in <code>this</code> as parameter for callback
}

void BaseClass::CallbackFuncA ()
{
    // do some stuff with the private vars in the class
}
derivedclass.h
#include "BaseClass.h"
class DrvClass : public BaseClass
{
public:
    DrvClass ();

    void DerivedFuncA ();
};
derivedclass.cpp
void DrvClass::DerivedFuncA ()
{
    BaseFuncA ();
    // more stuff
}

Thanks!!
Judy

Be wary of strong drink. It can make you shoot at tax collectors - and miss.
Lazarus Long, "Time Enough For Love" by Robert A. Heinlein

AnswerRe: function access in base and derived classes Pin
Richard Andrew x6422-Dec-09 10:25
professionalRichard Andrew x6422-Dec-09 10:25 
GeneralRe: function access in base and derived classes Pin
JudyL_MD22-Dec-09 11:14
JudyL_MD22-Dec-09 11:14 
GeneralRe: function access in base and derived classes Pin
Richard Andrew x6422-Dec-09 11:17
professionalRichard Andrew x6422-Dec-09 11:17 
GeneralRe: function access in base and derived classes Pin
Tim Craig22-Dec-09 14:07
Tim Craig22-Dec-09 14:07 
GeneralRe: function access in base and derived classes Pin
JudyL_MD22-Dec-09 16:24
JudyL_MD22-Dec-09 16:24 
GeneralRe: function access in base and derived classes Pin
Tim Craig22-Dec-09 17:06
Tim Craig22-Dec-09 17:06 
QuestionRe: function access in base and derived classes Pin
Avi Berger22-Dec-09 18:49
Avi Berger22-Dec-09 18:49 
AnswerRe: function access in base and derived classes Pin
Tim Craig22-Dec-09 18:58
Tim Craig22-Dec-09 18:58 
GeneralRe: function access in base and derived classes [modified] Pin
Avi Berger22-Dec-09 19:21
Avi Berger22-Dec-09 19:21 
GeneralRe: function access in base and derived classes Pin
Tim Craig22-Dec-09 21:36
Tim Craig22-Dec-09 21:36 
GeneralRe: function access in base and derived classes Pin
JudyL_MD23-Dec-09 2:20
JudyL_MD23-Dec-09 2:20 
GeneralRe: function access in base and derived classes Pin
Tim Craig23-Dec-09 9:31
Tim Craig23-Dec-09 9:31 
GeneralRe: function access in base and derived classes Pin
JudyL_MD23-Dec-09 10:08
JudyL_MD23-Dec-09 10:08 
Questionfatal error RC1015: cannot open include file 'res\Test.rc2' Pin
iwt.dev22-Dec-09 7:39
iwt.dev22-Dec-09 7:39 
AnswerRe: fatal error RC1015: cannot open include file 'res\Test.rc2' Pin
dxlee22-Dec-09 8:46
dxlee22-Dec-09 8:46 
AnswerRe: fatal error RC1015: cannot open include file 'res\Test.rc2' Pin
Abhi Lahare22-Dec-09 18:16
Abhi Lahare22-Dec-09 18:16 
Question[Message Deleted] Pin
transoft22-Dec-09 5:45
transoft22-Dec-09 5:45 

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.