Date: Wed, 17 Apr 2024 14:18:23 -0700
A derived object is just an object, with the base object being the first
thing in the object footprint. No allocation required. There are no
special heap mechanisms involved.
I believe the OP is confusing inheritance with dynamic-polymorphism that
requires the base to provide the interface, using the virtual mechanism.
You can use objects from multiple object pools (each pool of different
object types, each object derived from the same base), or multiple
static objects (each object derived from the same base), then be able to
treat the objects polymorphically, using a base pointer. No
allocation required.
Chris++;
On Wed, Apr 17, 2024 at 1:52 PM Tiago Freire via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> You can use the stack?
>
> Not sure I understand your question. As far as I know heap memory is not a
> requirement for inheritance.
>
>
>
> *From:* Std-Discussion <std-discussion-bounces_at_[hidden]> *On
> Behalf Of *Richard Bamford via Std-Discussion
> *Sent:* Wednesday, April 17, 2024 22:24
> *To:* std-discussion_at_[hidden]
> *Cc:* Richard Bamford <richardbamford1_at_[hidden]>
> *Subject:* [std-discussion] Safety critical C++ inheritance?
>
>
>
> Hi,
>
>
>
> The MISRA C++ programming standards and many safety critical applications
> are unable to use heap memory without filing deviations. Is there any way
> that programs aiming to follow those standards can use inheritance in C++
> without using heap memory?
>
>
>
> Thank you,
>
> Richard B.
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
thing in the object footprint. No allocation required. There are no
special heap mechanisms involved.
I believe the OP is confusing inheritance with dynamic-polymorphism that
requires the base to provide the interface, using the virtual mechanism.
You can use objects from multiple object pools (each pool of different
object types, each object derived from the same base), or multiple
static objects (each object derived from the same base), then be able to
treat the objects polymorphically, using a base pointer. No
allocation required.
Chris++;
On Wed, Apr 17, 2024 at 1:52 PM Tiago Freire via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> You can use the stack?
>
> Not sure I understand your question. As far as I know heap memory is not a
> requirement for inheritance.
>
>
>
> *From:* Std-Discussion <std-discussion-bounces_at_[hidden]> *On
> Behalf Of *Richard Bamford via Std-Discussion
> *Sent:* Wednesday, April 17, 2024 22:24
> *To:* std-discussion_at_[hidden]
> *Cc:* Richard Bamford <richardbamford1_at_[hidden]>
> *Subject:* [std-discussion] Safety critical C++ inheritance?
>
>
>
> Hi,
>
>
>
> The MISRA C++ programming standards and many safety critical applications
> are unable to use heap memory without filing deviations. Is there any way
> that programs aiming to follow those standards can use inheritance in C++
> without using heap memory?
>
>
>
> Thank you,
>
> Richard B.
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>
Received on 2024-04-17 21:18:39