Subject: RE: A question regarding CF.
From: Karl Lieberherr (lieber@ccs.neu.edu)
Date: Mon Oct 21 2002 - 22:03:11 EDT
Hi Ashwini:
p() returns an object of a local call and such an object
is viewed as a "computed part". So it is ok to call q().
Does this make sense?
-- Karl
> -----Original Message-----
> From: Ashwini Tumne [mailto:tumne.a@neu.edu]
> Sent: Monday, October 21, 2002 5:38 PM
> To: lieberherr@ccs.neu.edu
> Subject: A question regarding CF.
>
>
> Hello Prof. Lieberherr,
> I have a question regarding a program given in slides for basic intro
> to LoD.
>
> Consider the following program:
> class A {public: void m(); P p();};
> class P {public: Q q(); };
> class Q {public: void bar(); };
> void A::m() {
> this.p().q().bar();
> }
>
> The CF-violation in this case is given as .bar()
> My question is, why wouldnt it give violation when we call .q() ??
> because, in this case, the target object is created not in method m()
> but in method p() which returns the object of type P and on which we
> call q(). so isnt the violation occuring at this point??
> Is this because the fourth clause of the CF states that the preferred
> supplier object can be return type of 'a' method of the class. ie any
> method and since p() returns object of type P there is no violation
> there..??
> Please correct me if I am wrong in assuming something about the CF of
> LoD.
>
> Thank you
> Ashwini Tumne.
This archive was generated by hypermail 2b28 : Mon Oct 21 2002 - 22:00:04 EDT