Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDerived classes Pin
Waldermort17-Sep-06 23:48
Waldermort17-Sep-06 23:48 
AnswerRe: Derived classes Pin
toxcct17-Sep-06 23:58
toxcct17-Sep-06 23:58 
GeneralRe: Derived classes Pin
Waldermort18-Sep-06 0:03
Waldermort18-Sep-06 0:03 
GeneralRe: Derived classes Pin
toxcct18-Sep-06 0:08
toxcct18-Sep-06 0:08 
GeneralRe: Derived classes Pin
Waldermort18-Sep-06 0:21
Waldermort18-Sep-06 0:21 
GeneralRe: Derived classes Pin
toxcct18-Sep-06 0:23
toxcct18-Sep-06 0:23 
GeneralRe: Derived classes Pin
Waldermort18-Sep-06 0:36
Waldermort18-Sep-06 0:36 
GeneralRe: Derived classes Pin
Zac Howland18-Sep-06 3:22
Zac Howland18-Sep-06 3:22 
waldermort wrote:
Haha. Think of a deck of cards. The base class represents the table where the cards will be used. The derived classes represent various actions with the deck of cards ( shuffling, dealing... ). One of the derived classes inparticular represents all the cards currently visible (face up) on the table. When a card is dicarded, I call a member function of my discards class to add the card to an internal array. I must also add the card to the list of visible cards. But rather than calling two functions, I want to know if I can automate this from the discard class by calling a member function of the visible class directly.


If this is what you are trying to do, it sounds like you have a design flaw problem. Inheritence (public inheritance anyway) should follow an "is-a" relationship. What you are trying to do would be better suited for 2 collections (a collection of visible cards, and a collection of non-visible ones) with a manager to maintain the both. A class derived from the Deck of cards is not a good design for this problem.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

GeneralRe: Derived classes Pin
_AnsHUMAN_ 18-Sep-06 0:37
_AnsHUMAN_ 18-Sep-06 0:37 
GeneralRe: Derived classes Pin
Waldermort18-Sep-06 0:49
Waldermort18-Sep-06 0:49 
AnswerRe: Derived classes Pin
David Crow18-Sep-06 5:18
David Crow18-Sep-06 5:18 
QuestionError in Query execution Pin
vc++_fragrance17-Sep-06 23:22
vc++_fragrance17-Sep-06 23:22 
AnswerRe: Error in Query execution Pin
Nibu babu thomas17-Sep-06 23:34
Nibu babu thomas17-Sep-06 23:34 
AnswerRe: Error in Query execution Pin
toxcct17-Sep-06 23:38
toxcct17-Sep-06 23:38 
AnswerRe: Error in Query execution Pin
pelaez17-Sep-06 23:41
pelaez17-Sep-06 23:41 
GeneralRe: Error in Query execution Pin
toxcct17-Sep-06 23:44
toxcct17-Sep-06 23:44 
GeneralRe: Error in Query execution Pin
Naveen17-Sep-06 23:50
Naveen17-Sep-06 23:50 
GeneralRe: Error in Query execution Pin
toxcct17-Sep-06 23:55
toxcct17-Sep-06 23:55 
GeneralRe: Error in Query execution Pin
Nibu babu thomas17-Sep-06 23:58
Nibu babu thomas17-Sep-06 23:58 
GeneralRe: Error in Query execution Pin
Naveen18-Sep-06 0:03
Naveen18-Sep-06 0:03 
GeneralRe: Error in Query execution Pin
toxcct18-Sep-06 0:06
toxcct18-Sep-06 0:06 
GeneralRe: Error in Query execution Pin
Naveen18-Sep-06 0:09
Naveen18-Sep-06 0:09 
GeneralRe: Error in Query execution Pin
vc++_fragrance18-Sep-06 0:03
vc++_fragrance18-Sep-06 0:03 
GeneralRe: Error in Query execution Pin
toxcct18-Sep-06 0:10
toxcct18-Sep-06 0:10 
QuestionUnhandled Exception in CHtmlEdit.exe (MFC042D.DLL): 0*C0000005 : Access Violation error Pin
Roxy00717-Sep-06 23:16
Roxy00717-Sep-06 23:16 

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.