Re: C++ interface

From: E. Robert Tisdale (E.Robert.Tisdale_at_jpl.nasa.gov)
Date: 12/23/03


Date: Tue, 23 Dec 2003 09:37:41 -0800

The Directive wrote:

> Is there a way in C++ to create a "true" interface. I want to create
> an absract class that other classes can inherit from and be forced to
> implement the interface's abstract (pure virtual) methods. However, it
> has to be a true interface in that it doesn't add any overhead (when
> the derived object is created) with the interface's constructors and
> destructor because they don't exist for the interface. Does that make
> sense? I just want an interface, not all the OOP stuff like
> constructors, destructor and etc. In other words, I don't want the
> interface's (system default or user defined) constructors & destructor
> to be called.

A good optimizing C++ compiler should not add any overhead.
Can you show us an example where your C++ compiler adds such overhead?



Relevant Pages

  • Re: CPU recommendations?
    ... each time you add a new type of motor, ... There is therefore very little benefit in keeping a clean abstract interface and separation of code layers - it adds overhead to the generated code, and it adds overhead to the development. ... generated or used for templates, ...
    (comp.arch.embedded)
  • Re: MFC and c++ problems
    ... compiler to generate code that is architecturally nonsensical. ... So a design in which a control has any syntactic knowledge of any container of itself ... GetParent->SendMessage is the interface of choice, ...
    (microsoft.public.vc.mfc)
  • Re: Win32 API and gfortran
    ... write out a module containing only interface blocks and compile the ... that the /iface switches and ATTRIBUTES directives change the compiler ... arguments are passed in the normal Fortran way ...
    (comp.lang.fortran)
  • Re: Using early-bound interface on a late-bound object
    ... > the compiler determines which interfaces to use, ... > supports the declared interface. ... >> help if someone can point me to some authoritative document or reference ... within customer shops when they mirrored this 'division' to keep their ...
    (microsoft.public.vb.general.discussion)
  • Re: object system...
    ... in a statically compiled app, all of the type information is known at ... compiler starts integrating itself with the outside world, ... produces the result, the type or interface. ... optimizations the ...
    (comp.object)