Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Pointer to function and templates Pin
prasad_som29-Sep-05 1:29
prasad_som29-Sep-05 1:29 
AnswerRe: Pointer to function and templates Pin
Steen Krogsgaard30-Sep-05 3:00
Steen Krogsgaard30-Sep-05 3:00 
QuestionMFC object CFormView Pin
karmendra_js28-Sep-05 23:11
karmendra_js28-Sep-05 23:11 
AnswerRe: MFC object CFormView Pin
prasad_som29-Sep-05 0:36
prasad_som29-Sep-05 0:36 
QuestionRe: MFC object CFormView Pin
karmendra_js29-Sep-05 0:54
karmendra_js29-Sep-05 0:54 
AnswerRe: MFC object CFormView Pin
Steen Krogsgaard30-Sep-05 3:07
Steen Krogsgaard30-Sep-05 3:07 
QuestionVirtual function Pin
karmendra_js28-Sep-05 23:06
karmendra_js28-Sep-05 23:06 
AnswerRe: Virtual function Pin
Cedric Moonen28-Sep-05 23:43
Cedric Moonen28-Sep-05 23:43 
A virtual function is used when you use polymorphism. Let's take an example to make things clear.

Suppose you have two classes:

class Base<br />
{<br />
   virtual void Test();<br />
}<br />
<br />
class Child : public Base<br />
{<br />
   virtual void Test();<br />
}


So in this case, the Child class inherits from Base class. The Test function has been redefined in Child classes ans is virtual (you don't need to specify virtual again in the Child class).

Virtual functions are usefull when using pointers:

Base* pPtr = new Child;<br />
....<br />
....<br />
pPtr->Test();

In that case, even if the type of the object is CBase*, the funcion that will be called will be the one of the Child class. It is very usefull when you have different that inherits from the same base class. You can redefine in each a virtual function that will do something adapted for the class itself. Thus, you can store all these pointers in a table (containing pointers to the base class) and use their 'redefined' functions.
Questionvtbl question when derived Pin
followait28-Sep-05 22:44
followait28-Sep-05 22:44 
AnswerRe: vtbl question when derived Pin
Steen Krogsgaard30-Sep-05 3:37
Steen Krogsgaard30-Sep-05 3:37 
QuestionDeclare Byte Pin
Member 216100428-Sep-05 22:36
Member 216100428-Sep-05 22:36 
AnswerRe: Declare Byte Pin
kakan28-Sep-05 22:47
professionalkakan28-Sep-05 22:47 
GeneralRe: Declare Byte Pin
Member 216100428-Sep-05 23:20
Member 216100428-Sep-05 23:20 
GeneralRe: Declare Byte Pin
kakan28-Sep-05 23:29
professionalkakan28-Sep-05 23:29 
GeneralRe: Declare Byte Pin
toxcct28-Sep-05 23:38
toxcct28-Sep-05 23:38 
GeneralRe: Declare Byte Pin
kakan29-Sep-05 0:39
professionalkakan29-Sep-05 0:39 
GeneralRe: Declare Byte Pin
toxcct28-Sep-05 23:28
toxcct28-Sep-05 23:28 
AnswerRe: Declare Byte Pin
toxcct28-Sep-05 22:52
toxcct28-Sep-05 22:52 
AnswerRe: Declare Byte Pin
vikas amin28-Sep-05 23:05
vikas amin28-Sep-05 23:05 
QuestionCompiler Error C2504 please help Pin
WernerPos28-Sep-05 22:01
WernerPos28-Sep-05 22:01 
AnswerRe: Compiler Error C2504 please help Pin
Cedric Moonen28-Sep-05 22:07
Cedric Moonen28-Sep-05 22:07 
GeneralRe: Compiler Error C2504 please help Pin
WernerP28-Sep-05 22:38
WernerP28-Sep-05 22:38 
GeneralRe: Compiler Error C2504 please help Pin
WernerP28-Sep-05 22:46
WernerP28-Sep-05 22:46 
GeneralRe: Compiler Error C2504 please help Pin
WernerP29-Sep-05 1:42
WernerP29-Sep-05 1:42 
QuestionHow to get voice data Pin
pakFari28-Sep-05 21:14
pakFari28-Sep-05 21:14 

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.