[aspectc-user] run-time aspects
Jamal Siadat
siadat at cpsc.ucalgary.ca
Mon Nov 28 12:57:07 CET 2005
Hi,
Here is the second part:
if so when I am running the
>> program
>> can I have:
>> B b;
>> b.y=5;
>> If not, what alternatives would I have so I can just create B type at
>> run-time like above?
Which means I would like to create and access objects "B" or objects of
"C" since I assume B and C will be created as sub-classes of A when
compiled. If not What other alternatives do I have to compile two aspects
to extend a class and then create objects of each ?
Thanks,
> Hi,
>
> first of all, there are a few syntax errors in your code. For instance,
> aspect B should look like this:
>
> aspect B {
> pointcut add() = "A";
> advice add() : int y;
> };
>
> Besides this syntax problem, you could compile both aspects together
> with your component code. The weaver will introduce the new members "y"
> *and* "Q" into the class "A".
>
> Introductions are a means to implement *static* crosscutting. Therefore,
> all instances of A will contain both new members.
>
> I'm sorry, but I don't understand the second part of your question: "If
> the answer to the first part is yes Then is there any way create objects
> of A, B or C independently?". Could you try to explain it again or is my
> answer already sufficient?
>
> - Olaf
>
>
> Jamal Siadat wrote:
>> Hi All,
>> I just have a couple of questions I was wondering if you may address for
>> me please:
>> first Does AspectC++ suopport the expansion of a particular class by two
>> different aspects that may be compiled simuntaniously?
>> for instance is it possible to have a class "A" and use aspects "B" and
>> "C" to add some methods/variables to it. ( each of A and B add different
>> methods and variables).
>>
>> If the answer to the first part is yes Then is there any way create
>> objects of A, B or C independently? Here is an example:
>>
>> class A{
>> A();
>> ~A();
>> int a;
>> void b();
>> }
>>
>> aspect B {
>> pointcut add() : "A";
>> add (): int y;
>> //adding integer y to class A
>> };
>>
>> aspect C {
>> pointcut addition() : "A";
>> addition (): bool Q;
>> //adding bolean Q to class A
>> };
>>
>> Can I compile B and C simuntaniously? if so when I am running the
>> program
>> can I have:
>> B b;
>> b.y=5;
>> If not, what alternatives would I have so I can just create B type at
>> run-time like above?
>>
>> Thanks all,
>> Jamal
>>
>> _______________________________________________
>> aspectc-user mailing list
>> aspectc-user at aspectc.org
>> http://www.aspectc.org/mailman/listinfo/aspectc-user
>
More information about the aspectc-user
mailing list