[aspectc-user] How to introduce a method into a class ??
Jean J
jean_10452 at yahoo.fr
Thu Jul 29 10:33:54 CEST 2004
Thank you for you answer,
Now I am able to weave before/around/after advice into
my method calls/executions and introduce new
fields/methods into my classes.
I can see the result in the resulting file (ac.out by
default) generated by ac++.
BUT I have a problem when compiling (with ac++) this
file (ac.out that I rename test.cc) in the case where
I have introduced a method. I get the following error
:
test.ah:11: redefinition of `class TEST'
test.ah:11: previous definition here
In the case where i have introduced before/after
advice, the file compiles and links seamlessly to the
rest of my application.
I don't know if someone else has already encountered
such a problem and managed to solve it.
My aspect (test.ah) is the following :
#include<stdio.h>
aspect TEST {
public:
advice "Class1" :
void do_some_work() {
printf("doing some work\n");
}
};
And the resulting file in the generated ac.out has the
following code :
class Class1 {
public:
// original methods
public:
void do_some_work() {
printf("doing some work\n");
}
// other code
Thanks.
--- Bartosz Blimke <masb at chorwacja.com> a écrit :
> > Hello,
> >
> > I'm gonna look more into my code to see if there
> is a
> > problem else where. On the other hand what is the
> > syntax to indicate that this method is going to be
> > public ?
> >
> > thanks
> >
>
> Method introduced into the class has the same
> visiblity
> as the advice where it is defined inside an aspect.
> If you want it to be public in the target class,
> just define advice
> as a public.
>
> aspect TEST {
>
> public: // <- add public: keyword here
>
> advice "Class1" : void do_some_work() {
> cout << "doing some
> work" << endl;
> return;
> }
> };
>
> Bartosz
>
>
Vous manquez despace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
More information about the aspectc-user
mailing list