Click here to Skip to main content
15,886,799 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to get hash of account's password Pin
ngtv12-Aug-13 23:53
ngtv12-Aug-13 23:53 
GeneralRe: how to get hash of account's password Pin
sr333013-Aug-13 0:16
sr333013-Aug-13 0:16 
Questioni'm tring to initialise a sudoku board (9*9) using c++.getting a blank screen with blinking cursor as output. Pin
Member 1019329312-Aug-13 6:47
Member 1019329312-Aug-13 6:47 
AnswerRe: i'm tring to initialise a sudoku board (9*9) using c++.getting a blank screen with blinking cursor as output. Pin
jeron112-Aug-13 6:53
jeron112-Aug-13 6:53 
GeneralRe: i'm tring to initialise a sudoku board (9*9) using c++.getting a blank screen with blinking cursor as output. Pin
Sierra Technical12-Aug-13 7:54
Sierra Technical12-Aug-13 7:54 
QuestionRe: i'm tring to initialise a sudoku board (9*9) using c++.getting a blank screen with blinking cursor as output. Pin
David Crow12-Aug-13 8:00
David Crow12-Aug-13 8:00 
AnswerRe: i'm tring to initialise a sudoku board (9*9) using c++.getting a blank screen with blinking cursor as output. Pin
CPallini12-Aug-13 23:10
mveCPallini12-Aug-13 23:10 
QuestionName of this DesignPattern Pin
AmbiguousName12-Aug-13 1:43
AmbiguousName12-Aug-13 1:43 
Hello guys. I have this example which uses a design pattern. I don't know which design pattern is this.
I have this ClassMain, ClassParent, ClassChildOne and ClassChildTwo. ClassMain contains an array of type ClassParent, and stores the references of the two derived classes. Here is it how do I do it.
C++
// Main Class
class CClassMain
{
  #define MAX_COUNT 2
  CClassParent arrParent[MAX_COUNT];

  public void AddRef(CClassParent* ptr, int nIndex)
  {
    arrParent[nIndex] = ptr;
  }
}

// Parent class whose array is declared in CClassMain
class CClassParent
{
  static CClassMain* ptrMain;

  public CClassParent() { ptrMain = new CClassMain;}

  public void AddRef(int nIndex) { 
    ptrMain->AddRef(this, nIndex)
  }
}

// Child One
class CClassChildOne : CClassParent
{
  public CClassChildOne
  {
    CClassParent::AddRef(1);
  }
}

// Child Two
class CClassChildTwo : CClassParent
{
  public CClassChildTwo()
  {
    CClassParent::AddRef(2);
  }
}

The design pattern states that if I have to add new functionality (classes), it is really is easy now. I will simply increase the MAX_COUNT in CClassMain and derive the newly added class from CClassParent.

So what is the name of this design pattern and how do I study more about it specifically (and design patterns in general). Thanks for any info.

This world is going to explode due to international politics, SOON.

AnswerRe: Name of this DesignPattern Pin
Richard MacCutchan12-Aug-13 5:27
mveRichard MacCutchan12-Aug-13 5:27 
AnswerRe: Name of this DesignPattern Pin
pasztorpisti12-Aug-13 6:29
pasztorpisti12-Aug-13 6:29 
AnswerRe: Name of this DesignPattern Pin
jschell12-Aug-13 8:08
jschell12-Aug-13 8:08 
QuestionQT C1128: number of sections exceeded object file format limit : compile with /bigobj Pin
onur dalkilic11-Aug-13 22:13
onur dalkilic11-Aug-13 22:13 
AnswerRe: QT C1128: number of sections exceeded object file format limit : compile with /bigobj Pin
«_Superman_»11-Aug-13 22:31
professional«_Superman_»11-Aug-13 22:31 
AnswerRe: QT C1128: number of sections exceeded object file format limit : compile with /bigobj Pin
Stephen Hewitt12-Aug-13 16:15
Stephen Hewitt12-Aug-13 16:15 
Questionusing scardAPI how to get DeviceInstanceId Pin
xiliang_pan11-Aug-13 3:40
xiliang_pan11-Aug-13 3:40 
QuestionHow to use an event object for synchronization.? Pin
mbatra319-Aug-13 23:42
mbatra319-Aug-13 23:42 
AnswerRe: How to use an event object for synchronization.? Pin
Richard Andrew x6410-Aug-13 5:39
professionalRichard Andrew x6410-Aug-13 5:39 
AnswerRe: How to use an event object for synchronization.? Pin
pasztorpisti10-Aug-13 10:13
pasztorpisti10-Aug-13 10:13 
GeneralRe: How to use an event object for synchronization.? Pin
mbatra3111-Aug-13 21:18
mbatra3111-Aug-13 21:18 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti12-Aug-13 5:42
pasztorpisti12-Aug-13 5:42 
GeneralRe: How to use an event object for synchronization.? Pin
Erudite_Eric16-Aug-13 1:30
Erudite_Eric16-Aug-13 1:30 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti16-Aug-13 1:53
pasztorpisti16-Aug-13 1:53 
AnswerRe: How to use an event object for synchronization.? Pin
Krishnakumartg12-Aug-13 6:15
Krishnakumartg12-Aug-13 6:15 
AnswerRe: How to use an event object for synchronization.? Pin
Erudite_Eric16-Aug-13 1:32
Erudite_Eric16-Aug-13 1:32 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti16-Aug-13 1:52
pasztorpisti16-Aug-13 1:52 

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.