Click here to Skip to main content
16,015,018 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Christian Graus27-May-02 14:21
protectorChristian Graus27-May-02 14:21 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Rama Krishna Vavilala27-May-02 14:29
Rama Krishna Vavilala27-May-02 14:29 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Christian Graus27-May-02 14:47
protectorChristian Graus27-May-02 14:47 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Rama Krishna Vavilala27-May-02 14:58
Rama Krishna Vavilala27-May-02 14:58 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Christian Graus27-May-02 15:03
protectorChristian Graus27-May-02 15:03 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Rama Krishna Vavilala27-May-02 15:07
Rama Krishna Vavilala27-May-02 15:07 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Paul M Watt27-May-02 17:06
mentorPaul M Watt27-May-02 17:06 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Paul M Watt27-May-02 17:09
mentorPaul M Watt27-May-02 17:09 
That will create an abstract base class.

A virtual base class is used in multiple inheritance where you derive from two classes that derive from a common class like so:

class a;

class b : public a;
class c : public a;

class d: public b, public c;

Obviously this isn't valid C++ but hopefully you get the idea. In this case, you will get two intstances of the class a in class d. One that is a part of class b, the other that is a part of class c.

If you create a virtual base class with a, this will make it so that only one instance of a appears in the final class d, and this will prevent collisions because of the duplicate variables.


Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Michael Dunn27-May-02 16:05
sitebuilderMichael Dunn27-May-02 16:05 
GeneralRe: Has anyone ever felt the need to use virtual base classes Pin
Rama Krishna Vavilala27-May-02 16:13
Rama Krishna Vavilala27-May-02 16:13 
QuestionDo not use precompiled headers for a file? Pin
27-May-02 9:05
suss27-May-02 9:05 
AnswerRe: Do not use precompiled headers for a file? Pin
27-May-02 9:33
suss27-May-02 9:33 
AnswerRe: Do not use precompiled headers for a file? Pin
Joaquín M López Muñoz27-May-02 10:17
Joaquín M López Muñoz27-May-02 10:17 
GeneralRe: Do not use precompiled headers for a file? Pin
27-May-02 13:14
suss27-May-02 13:14 
GeneralRe: Do not use precompiled headers for a file? Pin
Rama Krishna Vavilala27-May-02 15:23
Rama Krishna Vavilala27-May-02 15:23 
GeneralRe: Do not use precompiled headers for a file? Pin
28-May-02 1:57
suss28-May-02 1:57 
AnswerRe: Do not use precompiled headers for a file? Pin
Joel Lucsy27-May-02 17:12
Joel Lucsy27-May-02 17:12 
GeneralDetermine if a string is a number Pin
Anton A. Loukine27-May-02 7:34
Anton A. Loukine27-May-02 7:34 
GeneralRe: Determine if a string is a number Pin
Ravi Bhavnani27-May-02 7:50
professionalRavi Bhavnani27-May-02 7:50 
GeneralRe: Determine if a string is a number Pin
Matt Gullett27-May-02 7:58
Matt Gullett27-May-02 7:58 
GeneralRe: Determine if a string is a number Pin
Anders Molin27-May-02 10:12
professionalAnders Molin27-May-02 10:12 
GeneralRe: Determine if a string is a number Pin
l a u r e n27-May-02 11:57
l a u r e n27-May-02 11:57 
GeneralRe: Determine if a string is a number Pin
Steve L.27-May-02 13:57
Steve L.27-May-02 13:57 
GeneralRe: Determine if a string is a number Pin
Ernest Laurentin28-May-02 6:11
Ernest Laurentin28-May-02 6:11 
GeneralRe: Determine if a string is a number Pin
Mike Nordell28-May-02 15:55
Mike Nordell28-May-02 15:55 

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.