Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Sun Dec 09, 2012 1:01 am
by ETS User
Re: the note about aggregation and the statement that D is a member object in A. Class C creates an instance of D, not A. So I'm confused as to why it can be said that A 'has-a' D.

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Sun Dec 09, 2012 7:46 am
by admin
The statement is about the code shown at the top of the explanation and not about the code in the question.

Code: Select all

Consider this code: 
class A extends B implements I
{
   D d = new D(); 
}

I agree that different names for the classes in the explanation would avoid this confusion.

HTH,
Paul.

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Sun Dec 09, 2012 11:50 pm
by ETS user
Thank you ... I missed that when I was reviewing answers.

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Wed Apr 17, 2013 10:00 am
by insider
Yes, it is needed to change class names for the code snippet in the explanation. I was the next to be confused.

I have another question. It is stated that "Aggregation defines a has-a relation.". However, Finegan/Liguori OCAJP study guide states that "direct association" stands for "has-a" and "aggregation association" stands for "is part of". Looks like they're kinda wrong.

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Thu May 15, 2014 10:06 am
by Nisim123
The question presents the following code:

interface X1{ }
interface X2{ }
class A { }
class B extends A implements X1{ }
class C extends B implements X2{
D d = new D();
}
class D { }

It is strange that one of the correct answers is:
C is-a A
While we all aware to the fact that inheritance works only for the 2nd generation, means only
for the class that extends it???
:roll:

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Thu May 15, 2014 11:38 am
by admin
Nisim123 wrote: While we all aware to the fact that inheritance works only for the 2nd generation, means only
for the class that extends it???
:roll:
That is not correct. Where did you read that?
Paul.

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Fri May 16, 2014 6:18 am
by Nisim123
I think, but still not sure, that it was the explanation to one of the questions about inheritance
of Enthuware Test Studios,
or that i read it in the Kathy Sierra & Bert Bates guide in chapter 2, but if you say that it is not correct, then I will accept it as is. It might be that it is true only about the implemented interfaces or something I should certainly check that out.
yours,
nisim. :|

Re: About Question enthuware.ocajp.i.v7.2.1064 :

Posted: Tue May 20, 2014 1:48 pm
by Nisim123
Well I probably was confused with calls to a constructor that can be only one class up...