[aspectc-user] aspect inhertitance

Antonio S. de A. Terceiro asaterceiro at inf.ufrgs.br
Sun May 1 01:11:32 CEST 2005

Jamal Siadat escreveu isso aĆ­:
> 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)

You can't assign a variable in a C++ class declaration, which is leading you to this error. There is nothing to do with aspects:

> aspect Action : public A {
> j=0;
>   advice  execution("% b(...)") : around()  {
> cout << "j is: "<< j <<endl;;
> }
> };

Try moving this 'y=0' to, for instance, an advice that match the
class constructor. Or removing it at all.

Antonio S. de A. Terceiro <asaterceiro at inf.ufrgs.br>
GnuPG ID: E6F73C30

More information about the aspectc-user mailing list