Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmatrix in window Pin
kiemxai6-May-09 14:45
kiemxai6-May-09 14:45 
AnswerRe: matrix in window Pin
Stuart Dootson6-May-09 19:41
professionalStuart Dootson6-May-09 19:41 
GeneralRe: matrix in window Pin
kiemxai6-May-09 23:19
kiemxai6-May-09 23:19 
GeneralRe: matrix in window Pin
Stuart Dootson6-May-09 23:22
professionalStuart Dootson6-May-09 23:22 
QuestionInclude order issues Pin
__DanC__6-May-09 9:53
__DanC__6-May-09 9:53 
AnswerRe: Include order issues Pin
Stuart Dootson6-May-09 10:40
professionalStuart Dootson6-May-09 10:40 
GeneralRe: Include order issues Pin
__DanC__6-May-09 11:00
__DanC__6-May-09 11:00 
GeneralRe: Include order issues Pin
Stuart Dootson6-May-09 11:14
professionalStuart Dootson6-May-09 11:14 
Pointers are good.

An alternative is to use the pimpl idiom[^]:

// a.h

class A
{
   A();
   // Stuff
private:
   struct A_impl;
   A_impl* impl_;
};

// b.h

class B
{
   B();
   // Stuff
private:
   struct B_impl;
   B_impl* impl_;
};

// a.cpp
#include "a.h"
#include "b.h"
struct A::A_impl
{
   B b;
};

A::A() : impl_(new A_impl) {}

// b.cpp
#include "b.h"
#include "a.h"
struct B::B_impl
{
   A a;
};

B::B() : impl_(new B_impl) {}


In either case, you need to take care with copy constructors and assignment operators.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Include order issues Pin
__DanC__6-May-09 21:06
__DanC__6-May-09 21:06 
Questionhelp extracting data Pin
dunlapjw6-May-09 7:42
dunlapjw6-May-09 7:42 
AnswerRe: help extracting data Pin
Madhu Nair6-May-09 8:41
Madhu Nair6-May-09 8:41 
QuestionRe: help extracting data Pin
David Crow6-May-09 8:42
David Crow6-May-09 8:42 
QuestionByte alignement - qt Pin
yaronillouz6-May-09 7:21
yaronillouz6-May-09 7:21 
AnswerRe: Byte alignement - qt Pin
Stuart Dootson6-May-09 8:31
professionalStuart Dootson6-May-09 8:31 
GeneralRe: Byte alignement - qt Pin
yaronillouz6-May-09 19:04
yaronillouz6-May-09 19:04 
GeneralRe: Byte alignement - qt Pin
Stuart Dootson6-May-09 19:35
professionalStuart Dootson6-May-09 19:35 
QuestionDocument/View Problem Pin
nick2reg6-May-09 6:30
nick2reg6-May-09 6:30 
AnswerRe: Document/View Problem Pin
Iain Clarke, Warrior Programmer6-May-09 7:00
Iain Clarke, Warrior Programmer6-May-09 7:00 
GeneralRe: Document/View Problem Pin
nick2reg6-May-09 8:08
nick2reg6-May-09 8:08 
AnswerRe: Document/View Problem Pin
Stuart Dootson6-May-09 7:01
professionalStuart Dootson6-May-09 7:01 
GeneralRe: Document/View Problem Pin
nick2reg6-May-09 8:10
nick2reg6-May-09 8:10 
AnswerRe: Document/View Problem Pin
David Crow6-May-09 8:48
David Crow6-May-09 8:48 
QuestionAssignment of read only location, class with const method trying to write to private member variable [modified] Pin
jeweladdict6-May-09 6:25
jeweladdict6-May-09 6:25 
AnswerRe: Assignment of read only location, class with const method trying to write to private member variable Pin
Stuart Dootson6-May-09 6:48
professionalStuart Dootson6-May-09 6:48 
GeneralRe: Assignment of read only location, class with const method trying to write to private member variable Pin
jeweladdict6-May-09 7:07
jeweladdict6-May-09 7:07 

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.