Click here to Skip to main content
15,891,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: displaying the files and folders in a list box Pin
Hamid_RT16-Oct-07 0:36
Hamid_RT16-Oct-07 0:36 
AnswerRe: displaying the files and folders in a list box Pin
Nelek15-Oct-07 20:47
protectorNelek15-Oct-07 20:47 
GeneralRe: displaying the files and folders in a list box Pin
David Crow16-Oct-07 2:55
David Crow16-Oct-07 2:55 
GeneralRe: displaying the files and folders in a list box Pin
Chandrasekharan P16-Oct-07 17:29
Chandrasekharan P16-Oct-07 17:29 
GeneralRe: displaying the files and folders in a list box Pin
David Crow17-Oct-07 3:56
David Crow17-Oct-07 3:56 
GeneralRe: displaying the files and folders in a list box Pin
Nelek29-Oct-07 22:01
protectorNelek29-Oct-07 22:01 
QuestionBase class pointer to Derived Class object?? Pin
Ash2015-Oct-07 20:25
Ash2015-Oct-07 20:25 
AnswerRe: Base class pointer to Derived Class object?? Pin
Cedric Moonen15-Oct-07 20:33
Cedric Moonen15-Oct-07 20:33 
It is in fact extremly powerfull and widely used. This is what is called 'polymorphism' (if you google for it, you'll probably find tons of information).

The principle is that you declare some virtual function in your base class that can be redefined by a derived class. In this way the derived class can have a different behavior as its parent. And, if you have several different derived classes that inherit from the same base class, they all can be treated as a base class but have different behavior (and, so, they can all be stored in an array for example).

If you want a typical example: suppose that you write a program to draw shapes (triangles, squares, circles, ...). What you would do in that case is have a base class CShape that has a virtual method Draw. Each derived class (CSquare, CCircle, CTriangle, ...) will specialize this Draw method for itself. All the shapes, as they are inherited by the same base class can be manipulated exactly the same way (they will be stored in an array, and whenever you need to redraw your drawing, you will call Draw from all the shapes in your array, no matter what shape it really is).

This is an extremly important concept in OOP.


Cédric Moonen
Software developer

Charting control [v1.2]

AnswerRe: Base class pointer to Derived Class object?? Pin
codeII15-Oct-07 20:49
codeII15-Oct-07 20:49 
GeneralRe: Base class pointer to Derived Class object?? Pin
Ash2015-Oct-07 22:19
Ash2015-Oct-07 22:19 
QuestionHow to create Webpage Viewer Pin
Soumyadipta15-Oct-07 19:53
Soumyadipta15-Oct-07 19:53 
AnswerRe: How to create Webpage Viewer Pin
Hamid_RT15-Oct-07 20:43
Hamid_RT15-Oct-07 20:43 
QuestionBrowser Control Pin
Soumyadipta15-Oct-07 19:44
Soumyadipta15-Oct-07 19:44 
Question[SOLVED] Read a file on click event Pin
CodingLover15-Oct-07 19:22
CodingLover15-Oct-07 19:22 
AnswerRe: Read a file on click event Pin
chandu00415-Oct-07 19:46
chandu00415-Oct-07 19:46 
GeneralRe: Read a file on click event Pin
CodingLover15-Oct-07 20:02
CodingLover15-Oct-07 20:02 
GeneralRe: Read a file on click event Pin
chandu00415-Oct-07 20:05
chandu00415-Oct-07 20:05 
GeneralRe: Read a file on click event Pin
CodingLover15-Oct-07 20:14
CodingLover15-Oct-07 20:14 
GeneralRe: Read a file on click event Pin
chandu00415-Oct-07 20:24
chandu00415-Oct-07 20:24 
GeneralRe: Read a file on click event Pin
CodingLover15-Oct-07 20:29
CodingLover15-Oct-07 20:29 
GeneralRe: Read a file on click event Pin
chandu00415-Oct-07 20:27
chandu00415-Oct-07 20:27 
GeneralRe: Read a file on click event Pin
CodingLover15-Oct-07 20:33
CodingLover15-Oct-07 20:33 
GeneralRe: Read a file on click event Pin
chandu00415-Oct-07 20:48
chandu00415-Oct-07 20:48 
AnswerRe: Read a file on click event Pin
Nishad S15-Oct-07 20:41
Nishad S15-Oct-07 20:41 
GeneralRe: Read a file on click event Pin
CodingLover15-Oct-07 20:57
CodingLover15-Oct-07 20:57 

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.