Click here to Skip to main content
15,905,233 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: reagarding doubt with our project!! Pin
Rajesh R Subramanian18-Mar-08 22:38
professionalRajesh R Subramanian18-Mar-08 22:38 
GeneralRe: reagarding doubt with our project!! Pin
Naveen18-Mar-08 22:44
Naveen18-Mar-08 22:44 
QuestionRe: reagarding doubt with our project!! Pin
David Crow19-Mar-08 4:20
David Crow19-Mar-08 4:20 
GeneralELF parser Pin
Ravinder Are18-Mar-08 19:52
Ravinder Are18-Mar-08 19:52 
GeneralRe: ELF parser Pin
CPallini18-Mar-08 22:57
mveCPallini18-Mar-08 22:57 
AnswerRe: ELF parser Pin
JudyL_MD19-Mar-08 2:45
JudyL_MD19-Mar-08 2:45 
QuestionHow do they do that? virutal lan Pin
NovaNuker18-Mar-08 19:34
NovaNuker18-Mar-08 19:34 
GeneralVirtual function design pattern Pin
George_George18-Mar-08 19:18
George_George18-Mar-08 19:18 
Hello everyone,


About the virtual function design pattern mentioned,

http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.4

I do not quite understand what does this statement mean "Assuming they're protected, they probably shouldn't be virtual: if the derived class doesn't like the behavior in one of them, it doesn't have to call that method." Any ideas?

I quote the whole paragraph here,

--------------------
Suppose you have the exact opposite situation from the previous FAQ, where you have a method whose overall structure is different in each derived class, yet it has little pieces that are the same in most (if not all) derived classes. In this case you'd put the overall algorithm in a public virtual that's ultimately defined in the derived classes, and the little pieces of common code can be written once (to avoid code duplication) and stashed somewhere (anywhere!). A common place to stash the little pieces is in the protected part of the base class, but that's not necessary and it might not even be best. Just find a place to stash them and you'll be fine. Note that if you do stash them in the base class, you should normally make them protected, since normally they do things that public users don't need/want to do. Assuming they're protected, they probably shouldn't be virtual: if the derived class doesn't like the behavior in one of them, it doesn't have to call that method.
--------------------


thanks in advance,
George
GeneralRe: Virtual function design pattern Pin
followait18-Mar-08 20:00
followait18-Mar-08 20:00 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 0:00
George_George19-Mar-08 0:00 
GeneralRe: Virtual function design pattern Pin
CPallini19-Mar-08 0:54
mveCPallini19-Mar-08 0:54 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 1:14
George_George19-Mar-08 1:14 
GeneralRe: Virtual function design pattern Pin
CPallini19-Mar-08 1:31
mveCPallini19-Mar-08 1:31 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 2:30
George_George19-Mar-08 2:30 
GeneralRe: Virtual function design pattern Pin
CPallini19-Mar-08 3:01
mveCPallini19-Mar-08 3:01 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 3:15
George_George19-Mar-08 3:15 
GeneralRe: Virtual function design pattern Pin
CPallini19-Mar-08 3:29
mveCPallini19-Mar-08 3:29 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 17:20
George_George19-Mar-08 17:20 
GeneralRe: Virtual function design pattern Pin
CPallini19-Mar-08 22:26
mveCPallini19-Mar-08 22:26 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 22:38
George_George19-Mar-08 22:38 
GeneralRe: Virtual function design pattern Pin
followait19-Mar-08 1:42
followait19-Mar-08 1:42 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 2:21
George_George19-Mar-08 2:21 
GeneralRe: Virtual function design pattern [modified] Pin
followait19-Mar-08 2:49
followait19-Mar-08 2:49 
GeneralRe: Virtual function design pattern Pin
George_George19-Mar-08 3:16
George_George19-Mar-08 3:16 
GeneralRe: Virtual function design pattern Pin
followait19-Mar-08 3:37
followait19-Mar-08 3:37 

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.