Click here to Skip to main content
15,909,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem with Multiple Instances of ActiveX Control, Please Help Pin
rdeekonda16-Mar-05 18:27
rdeekonda16-Mar-05 18:27 
GeneralHelp on Compiled HTML(CHM) Viewer Pin
anukrati16-Mar-05 18:13
anukrati16-Mar-05 18:13 
GeneralFrame comparison Pin
Francis Chau16-Mar-05 17:12
Francis Chau16-Mar-05 17:12 
Generalvirutal class and friend class Pin
phijophlip16-Mar-05 17:10
phijophlip16-Mar-05 17:10 
GeneralRe: virutal class and friend class Pin
HalfWayMan16-Mar-05 22:32
HalfWayMan16-Mar-05 22:32 
Generaldifference between virutal class and friend class Pin
phijophlip16-Mar-05 17:10
phijophlip16-Mar-05 17:10 
GeneralRe: difference between virutal class and friend class Pin
ThatsAlok16-Mar-05 18:08
ThatsAlok16-Mar-05 18:08 
GeneralRe: difference between virutal class and friend class Pin
toxcct16-Mar-05 21:31
toxcct16-Mar-05 21:31 
Mist'Alok is right, you should learn a bit more about the language features itself.

however, i'll try to answer...

friends functions are made to access to protected members of an object from the outside of it.

virtual functions are a bit more difficult to assimilate.
this keyword is use for inheritance. for example :


<font color=#0000FF>class </font>A {
<font color=#0000FF>protected</font>:
    <font color=#0000FF>int</font> m_iData;
<font color=#0000FF>public</font>:
    A() {
        m_iData = 1;
    }
    <font color=#0000FF>int</font> Disp() {
        <font color=#0000FF>return</font> m_iData;
    }
};

<font color=#0000FF>class</font> B : <font color=#0000FF>public</font> A {
    B() : A() {
        m_iData = 2;
    }
    <font color=#0000FF>int</font> Disp() {
        <font color=#0000FF>return </font>m_iData;
    }
};
you could do that to execute :
A* a = B();
printf(<font color=#808080>"%d"</font>, a->Disp());
The output is
1

Now, if A::Disp() had been declared as virtual, the output would be
2

could you understand why ? Big Grin | :-D


TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralCreating a graph chart Pin
Anonymous16-Mar-05 16:48
Anonymous16-Mar-05 16:48 
GeneralCompilation errors in Debug mode Pin
Gagnon Claude16-Mar-05 16:35
Gagnon Claude16-Mar-05 16:35 
GeneralRe: Compilation errors in Debug mode Pin
toxcct16-Mar-05 21:11
toxcct16-Mar-05 21:11 
Generaldrop down scroll bar too small Pin
catdude16-Mar-05 16:33
catdude16-Mar-05 16:33 
GeneralRe: drop down scroll bar too small Pin
Roger Allen17-Mar-05 0:07
Roger Allen17-Mar-05 0:07 
GeneralRe: drop down scroll bar too small Pin
catdude17-Mar-05 2:07
catdude17-Mar-05 2:07 
GeneralDetecting mouse clicks outside my dialog Pin
djtommye16-Mar-05 15:59
djtommye16-Mar-05 15:59 
GeneralRe: Detecting mouse clicks outside my dialog Pin
namaskaaram16-Mar-05 19:51
namaskaaram16-Mar-05 19:51 
GeneralRe: Detecting mouse clicks outside my dialog Pin
djtommye17-Mar-05 19:26
djtommye17-Mar-05 19:26 
GeneralRe: Detecting mouse clicks outside my dialog Pin
namaskaaram17-Mar-05 19:51
namaskaaram17-Mar-05 19:51 
GeneralVS6 and Inline Assembly Pin
quantum6916-Mar-05 15:58
quantum6916-Mar-05 15:58 
GeneralRe: VS6 and Inline Assembly Pin
David Crow17-Mar-05 3:24
David Crow17-Mar-05 3:24 
GeneralRe: VS6 and Inline Assembly Pin
John R. Shaw17-Mar-05 7:21
John R. Shaw17-Mar-05 7:21 
GeneralRe: VS6 and Inline Assembly Pin
quantum6917-Mar-05 15:29
quantum6917-Mar-05 15:29 
Generalhooking my mouse Pin
shdwwlkr16-Mar-05 15:37
shdwwlkr16-Mar-05 15:37 
GeneralRe: hooking my mouse Pin
John R. Shaw17-Mar-05 7:26
John R. Shaw17-Mar-05 7:26 
GeneralRe: hooking my mouse Pin
shdwwlkr17-Mar-05 15:04
shdwwlkr17-Mar-05 15:04 

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.