Re: vtable on stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Frank Winter:

> I think, its not possible to make use of the vtable with objects
> living on the stack.

This is not true.  C++'s brand of polymorphism does not interact well
with copying (due to slicing).  Your examples stress this point.

Put differently, you want to create an object of a type which is not
known at compile-time.  This is not directly possible in C++.
Workarounds generally use the heap because unknown types have unknown
sizes, and objects of unknown size don't mix well with stack
allocation.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux