Click here to Skip to main content
14,923,455 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Migrating old project to VS2008 - resource file errors Pin
charlieg24-Sep-16 0:48
Membercharlieg24-Sep-16 0:48 
Questionhow to be sure each child class inherits a method? Pin
FriendOfAsherah2-Aug-16 19:58
MemberFriendOfAsherah2-Aug-16 19:58 
AnswerRe: how to be sure each child class inherits a method? Pin
Richard MacCutchan2-Aug-16 20:28
mveRichard MacCutchan2-Aug-16 20:28 
GeneralRe: how to be sure each child class inherits a method? Pin
FriendOfAsherah2-Aug-16 20:49
MemberFriendOfAsherah2-Aug-16 20:49 
GeneralRe: how to be sure each child class inherits a method? Pin
Richard MacCutchan2-Aug-16 21:03
mveRichard MacCutchan2-Aug-16 21:03 
GeneralRe: how to be sure each child class inherits a method? Pin
FriendOfAsherah2-Aug-16 21:29
MemberFriendOfAsherah2-Aug-16 21:29 
GeneralRe: how to be sure each child class inherits a method? Pin
Richard MacCutchan3-Aug-16 3:15
mveRichard MacCutchan3-Aug-16 3:15 
GeneralRe: how to be sure each child class inherits a method? Pin
FriendOfAsherah3-Aug-16 19:23
MemberFriendOfAsherah3-Aug-16 19:23 
The structure is:
CBase <- C1 <- C2 <- ... etc
so straigt inheritance

CBase contains the main method CBase::F() which does all calculations needed.
And this method F() calls P() which should be choosen by inheritance (polymorphism)
CBase::F() { ...; P(); ... }

If I have CBase* b = new C2() than C2::P() will be called.
If I have CBase* b = new C1() than C1::P() will be called.
because of P() is a virtual method, overridden by C1::P().. C2::P() etc

now I miss C1::P() (forgot to add it) =>
if CBase b=new C1() then CBase::F() will call CBase::P() instead of C1::P() because there is no C1::P()

the override clause also tells the compiler to check if C1::P(), C2::P() match their parents P().

All is cointained by a complex chaotic SW-project which I will clean by small steps.
The idea behind:
P() is a call to a factory class which creates objects dependend on parameters AND on the class from which is called

CBase::P(int type) creates objects of CPbase_<type> so CPbase_1, CPbase_2...
C1::P(int type) creates obejcts of CP1_<type> so CP1_1, CP1_2...
C2::P(int type) creates obejcts of CP2_<type> so CP2_1, CP2_2...
etc...

CBase::F(switch,type) : if (switch) P(type) else CBase::P(type) ...
So if switch is set call the factory "of the class", else call the factory of CBase

example:
Cbase b = new C1();
b->F(true, 3) will create an object of C1_3()

All the pointers are stored in a list and for each element in the list the creation-funbtion F() is called

list ... C1*,CBase*,C3* etc ...
foreach element in list , element->F(switch,type) ...
SuggestionRe: how to be sure each child class inherits a method? Pin
Krishnakumartg21-Sep-16 20:19
MemberKrishnakumartg21-Sep-16 20:19 
QuestionCrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
ForNow2-Aug-16 16:38
MemberForNow2-Aug-16 16:38 
QuestionRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
Richard MacCutchan2-Aug-16 20:24
mveRichard MacCutchan2-Aug-16 20:24 
AnswerRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
ForNow2-Aug-16 23:25
MemberForNow2-Aug-16 23:25 
GeneralRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
Richard MacCutchan3-Aug-16 3:11
mveRichard MacCutchan3-Aug-16 3:11 
AnswerRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
leon de boer4-Aug-16 5:19
Memberleon de boer4-Aug-16 5:19 
GeneralRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
ForNow4-Aug-16 5:29
MemberForNow4-Aug-16 5:29 
GeneralRe: Had a number of controls CTEXT and I didn't allocate Corresponding Ctatic Pointers thanks Pin
ForNow5-Aug-16 5:29
MemberForNow5-Aug-16 5:29 
QuestionRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
David Crow6-Aug-16 17:03
MemberDavid Crow6-Aug-16 17:03 
AnswerRe: CrichEditCtrl::Find returns zero when second RichEdit is Created as a Child of A Different CDialog Pin
ForNow6-Aug-16 17:24
MemberForNow6-Aug-16 17:24 
QuestionUnhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
ForNow1-Aug-16 8:04
MemberForNow1-Aug-16 8:04 
AnswerRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
Victor Nijegorodov1-Aug-16 11:02
MemberVictor Nijegorodov1-Aug-16 11:02 
GeneralRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
ForNow1-Aug-16 12:46
MemberForNow1-Aug-16 12:46 
GeneralRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
leon de boer1-Aug-16 16:09
Memberleon de boer1-Aug-16 16:09 
AnswerRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
Richard MacCutchan1-Aug-16 22:05
mveRichard MacCutchan1-Aug-16 22:05 
GeneralRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
ForNow2-Aug-16 1:53
MemberForNow2-Aug-16 1:53 
GeneralRe: Unhandled exception in ntdll.dll access violation reading location 0xFFFFFFFFFFFFFFFF Pin
Richard MacCutchan2-Aug-16 2:01
mveRichard MacCutchan2-Aug-16 2:01 

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.