Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-26 08:31:23


----- Original Message -----
From: "Vladimir Prus" <ghost_at_[hidden]>

> David Abrahams wrote:
> > struct A {
> > virtual void f();
> > virtual void g();
> > };
> >
> > struct B : A {
> > virtual void g();
> > };
> >
> > If I had to guesss at the meaning of "derived method", I would tend
to
> > say that B::g() is a derived method of A. Of course calling a
derived
> > method in that case makes no sense for anything that's actually a B.
> >
> > I would say that A::f() is an "inherited method" of B.
>
> I used to call them "derived" all the time, but may be wrong and don't
have
> any books handy where I can find the right name. Okay... will use
"inherited".
>
> > Now I'm guessing that you wanted to do something like calling A::g()
> > from B::g()?
>
> Yes.

In that case, you shouldn't call it "inherited" either. A::g() is an
overridden method of B's base, and /not/ inherited the way f() is. I
would just call it a "base class method".

I think the way to approach this is to import the method from A as A.g,
using the optional LOCALIZE argument:

* builtin_import() - IMPORT ( SOURCE_MODULE ? : SOURCE_RULES * :
TARGET_MODULE ? : TARGET_RULES * : LOCALIZE ? )
*
* The IMPORT rule imports rules from the SOURCE_MODULE into the
* TARGET_MODULE as local rules. If either SOURCE_MODULE or
* TARGET_MODULE is not supplied, it refers to the global
* module. SOURCE_RULES specifies which rules from the SOURCE_MODULE
* to import; TARGET_RULES specifies the names to give those rules in
* TARGET_MODULE. If SOURCE_RULES contains a name which doesn't
* correspond to a rule in SOURCE_MODULE, or if it contains a
* different number of items than TARGET_RULES, an error is issued.
* if LOCALIZE is specified, the rules will be executed in
* TARGET_MODULE, with corresponding access to its module local
* variables.

This needs to be documented in the HTML, obviously.

-Dave

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk