Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualwintertime

Posted 27 January 2013 - 11:05 AM

1. That has nothing to do with virtual inheritance. Its to leave the possibility open that programmers make a class hierarchy with more than 2 steps where they continuously add common functionality first and later more specialized. If you try to make a BorderedWindow or WindowWithMenu you will see the compiler guards against this because its an abstract class like Window.
2. Should be the same if it both compiles.

Btw., you should always add a virtual destructor to any baseclass with a virtual method to prevent errors when you only have a pointer or reference to a baseclass which you initialized with an object of the derived class.

#1wintertime

Posted 27 January 2013 - 11:03 AM

1. That has nothing to do with virtual inheritance. Its to leave to possibility that programmers make a class hierarchy with more than 2 steps where they continuously add common functionality first and later more specialized. If you try to make a BorderedWindow or WindowWithMenu you will see the compiler guards against this because its an abstract class like Window.

2. Should be the same if it both compiles.

 

Btw., you should always add a virtual constructor to any baseclass with a virtual method to prevent errors when you only have a pointer or reference to a baseclass which you initialized with an object of the derived class.


PARTNERS