[aspectc-user] concrete aspects: can or can not be inherited from?

Panu Bloigu panu.bloigu at mbnet.fi
Fri Mar 23 17:16:28 CET 2007


Hello.

Until recently I've been under the impression that only abstract aspects 
can be inherited from. Now I'm not so sure anymore. I'll present some 
code that I find rather confusing as it seems that concrete aspects 
indeed *can* be inherited from.

=============================================================================
#include <iostream>
aspect Base
{
    pointcut pc() = "int main()";
       
    advice execution(pc()) : around()
    {
        std::cout<<"Before from base!\n";
        tjp->proceed();
    }
   
};

class Class : public Base
{
public:
    Class(){}
    virtual ~Class(){}   
};


aspect Inherited : public Class
{

    advice execution(pc()) : around()
    {
        std::cout<<"Before from Inherited!\n";
        tjp->proceed();
    } 
};
=============================================================================

This compiles fine and prints out:

Before from base!
Before from Inherited!

Would someone care to comment what's going on here? To me this seems 
like non-abstract aspects can be inherited from if a regular class is as 
a mediator. Is this an intentional feature or is it something else? I'm 
confused.

Thanks,

Panu.




More information about the aspectc-user mailing list