[aspectc-user] aspect inhertitance
Jamal Siadat
siadat at cpsc.ucalgary.ca
Sat Apr 30 03:51:07 CEST 2005
Hi I have a couple of questions for you. Does aspect C++ support
inheritance between an aspect and a class ( i.e. can an aspect use some of
the member functions and variables of a class by having it as a
superclass?)
If it does then I seem to be having dificulties using it. I have class
called A and an aspect called Action with the following code:
class A {
public:
int a(int i, float b);
static int j;
};
#include <iostream.h>
#include"A.h"
aspect Action : public A {
j=0;
advice execution("% b(...)") : around() {
cout << "j is: "<< j <<endl;;
}
};
When I run the ac++ preprocessor on it, it works fine and it generates me
the c++ file to compile. but when I compile that with g++, it gives me the
following errors:
trace.ah:4: error: ISO C++ forbids declaration of `j' with no type
trace.ah:4: error: ISO C++ forbids initialization of member `j'
trace.ah:4: error: making `j' static
trace.ah:4: error: ISO C++ forbids in-class initialization of non-const
static member `j'
which leads me to think that aspects cant inherite from classes. If thats
not the case can you please tell what other routs I can try .. I just want
to print the value of j ( which should be 0)
Thanks in advance
More information about the aspectc-user
mailing list