Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 25 Jun 2012 07:06 PM |
Okay, remember that one thread that went completely off topic? That's okay, because I found a quote that explains the construction of virtual base classes. I don't get it, but maybe you do.
In a non-delegating constructor, initialization proceeds in the following order:
First, and only for the constructor of the most derived class (1.8), virtual base classes are initialized in the order they appear on a depth-first left-to-right traversal of the directed acyclic graph of base classes, where “left-to-right” is the order of appearance of the base classes in the derived class base-specifier-list.
Then, direct base classes are initialized in declaration order as they appear in the base-specifier-list (regardless of the order of the mem-initializers).
Then, non-static data members are initialized in the order they were declared in the class definition (again regardless of the order of the mem-initializers).
Finally, the compound-statement of the constructor body is executed.
[Note:The declaration order is mandated to ensure that base and member subobjects are destroyed in the reverse order of initialization. —end note] ----- Mind explaining the first sentence (In a non-delegating constructor...) and the first paragraph to me? |
|
|
| Report Abuse |
|
|
NVI
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 4744 |
|
|
| 25 Jun 2012 07:31 PM |
| It means the destructor won't be called unless it's virtual in the base class. Have fun. |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 25 Jun 2012 09:34 PM |
@NVI,
Err.. are you sure about that? |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 09:35 PM |
| it means that the flux capacitor requires 1.21 jigawatts of electrical power to operate |
|
|
| Report Abuse |
|
|
Flurite
|
  |
| Joined: 03 Apr 2011 |
| Total Posts: 5386 |
|
|
| 26 Jun 2012 06:24 AM |
*reads first sentence of original post* *reads these posts*
. _ . |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2012 06:27 AM |
I worry about the brains of some of these people, Flurite.
~>dat siggy<~ |
|
|
| Report Abuse |
|
|
ENET
|
  |
| Joined: 01 Jan 2010 |
| Total Posts: 4820 |
|
|
| 26 Jun 2012 10:05 AM |
It has to do with making sub classes and over-riding the base classes constructor and destructor function. If you don't have the base classes constructor and destructor function virtual you can't override it. Something like that....
You should look up virtual methods/functions before going directly to classes. But the virtual keyword is like saying "this is a method and the subclasses can change how it is called".... rather than saying "this method can't be changed by subclasses." |
|
|
| Report Abuse |
|
|