Click here to Skip to main content
15,911,762 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Crashing at RegQueryValueEx Pin
krmed10-Jul-08 2:14
krmed10-Jul-08 2:14 
QuestionC++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 15:14
Kishore Jonnalagadda9-Jul-08 15:14 
AnswerRe: C++ wrappers for C struct api Pin
Saurabh.Garg9-Jul-08 17:57
Saurabh.Garg9-Jul-08 17:57 
GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 18:25
Kishore Jonnalagadda9-Jul-08 18:25 
GeneralRe: C++ wrappers for C struct api Pin
Saurabh.Garg9-Jul-08 23:25
Saurabh.Garg9-Jul-08 23:25 
GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda10-Jul-08 0:11
Kishore Jonnalagadda10-Jul-08 0:11 
GeneralRe: C++ wrappers for C struct api Pin
Saurabh.Garg10-Jul-08 0:56
Saurabh.Garg10-Jul-08 0:56 
AnswerRe: C++ wrappers for C struct api Pin
BadKarma9-Jul-08 22:54
BadKarma9-Jul-08 22:54 
Hi,

you're doing something i don't get.

on the C Side you got
struct Time
{
int seconds,
int nanoseconds
};

and
struct Timer
{
struct Time time;
void (*callback)(struct Timer *timer);
};

The Timer struct encapsulates the Time struct, because in C you don't have inheritance. This is correct. But on the C++ side you got
class Time
{
public:
// constructor & destructor
...
// functions
...
protected:
C::Time m_time;
};

and
class Timer : public Time
{
public:
// constructor & destructor
...
// functions
...
protected:
static void callback(struct Timer *timer);
C::Timer m_timer;
};

Here you make some design error.
The class time encapsulates the 'c' Time struct and giving it some extra functionality. No problem so far. But you're class Timer inherits from the Time class and encapsulates the 'c' timer struct.
Giving you indeed twice the 'c' time struct. According to me this is a fault in the design. The 'C' and 'C++' counterparts are NOT equivalent.
To make the equivalent you should encapsulate either the 'C' Timer struct, or, inherit from the Time class and adding the needed Callback function. But you can't do both.

Why do you inherit from the time class?

Learn from the mistakes of others, you may not live long enough to make them all yourself.

GeneralRe: C++ wrappers for C struct api Pin
Kishore Jonnalagadda9-Jul-08 23:54
Kishore Jonnalagadda9-Jul-08 23:54 
Questioncall a vbscript and get an output Pin
rocktx9-Jul-08 9:32
rocktx9-Jul-08 9:32 
AnswerRe: call a vbscript and get an output Pin
led mike9-Jul-08 10:10
led mike9-Jul-08 10:10 
QuestionGDI+ Region Outline question Pin
Iain Clarke, Warrior Programmer9-Jul-08 5:44
Iain Clarke, Warrior Programmer9-Jul-08 5:44 
AnswerRe: GDI+ Region Outline question Pin
Mark Salsbery9-Jul-08 6:21
Mark Salsbery9-Jul-08 6:21 
GeneralRe: GDI+ Region Outline question Pin
Iain Clarke, Warrior Programmer9-Jul-08 11:36
Iain Clarke, Warrior Programmer9-Jul-08 11:36 
QuestionRetriving the user privilage set using WINAPI Pin
vineeshV9-Jul-08 3:17
vineeshV9-Jul-08 3:17 
AnswerRe: Retriving the user privilage set using WINAPI Pin
Iain Clarke, Warrior Programmer9-Jul-08 4:47
Iain Clarke, Warrior Programmer9-Jul-08 4:47 
GeneralRe: Retriving the user privilage set using WINAPI Pin
David Crow9-Jul-08 5:03
David Crow9-Jul-08 5:03 
Questionfriend member function in VC++ 2008 Pin
Andy Rama9-Jul-08 2:45
Andy Rama9-Jul-08 2:45 
AnswerRe: friend member function in VC++ 2008 Pin
Nibu babu thomas9-Jul-08 2:53
Nibu babu thomas9-Jul-08 2:53 
GeneralRe: friend member function in VC++ 2008 Pin
Andy Rama9-Jul-08 3:05
Andy Rama9-Jul-08 3:05 
QuestionRe: friend member function in VC++ 2008 Pin
David Crow9-Jul-08 2:56
David Crow9-Jul-08 2:56 
AnswerRe: friend member function in VC++ 2008 Pin
Andy Rama9-Jul-08 2:58
Andy Rama9-Jul-08 2:58 
GeneralRe: friend member function in VC++ 2008 Pin
toxcct9-Jul-08 5:54
toxcct9-Jul-08 5:54 
QuestionRe: friend member function in VC++ 2008 Pin
Andy Rama9-Jul-08 20:20
Andy Rama9-Jul-08 20:20 
Questiondisplay message Pin
tns_ranjith8-Jul-08 23:46
tns_ranjith8-Jul-08 23:46 

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.