Objects by Design Forums Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home  
Objects by Design Forums : Powered by vBulletin version 2.3.5 Objects by Design Forums > Main Forums > UML Certification Review Questions > Subclasses
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
kotiyal
Junior Member

Registered: Feb 2002
Location:
Posts: 2

Exclamation Subclasses

Hi All,

Need your help..

There is a question in the IBM Sample test dealing with Subclassing, where X and Y are the two classes inheriting (I guess its Inheritance only) from the Mortgageable class. The possible answers (2 correct ) are:

a) Classes "X" and "Y" are subclasses of Mortgageable.

b) Instances of "X" and "Y" can be passed as parameters declared as type Mortgageable.

c) "X" and "Y" must implement a getAppraisedValue() method.

d) There are instances of Mortgageable in the production system


What are the correct ones ? a and c ?

Report this post to a moderator | IP: Logged

Old Post 02-08-2002 04:38 PM
kotiyal is offline Click Here to See the Profile for kotiyal Click here to Send kotiyal a Private Message Find more posts by kotiyal Add kotiyal to your buddy list Edit/Delete Message Reply w/Quote
Stephen Hosking
Member

Registered: Nov 2001
Location:
Posts: 54

I say (a) and (b)

I haven't seen this question, but (a) and (b) look true to me. (a) is obvious. (b) is also true, and this one is very important for exam preparation - just remember that an instance of a subclass can be used anywhere that an instance of the superclass can. See Larman pg. 399, and Booch... UML User Guide "Objects of the child are substitutable for objects of the parent" (pg. 438). You will almost certainly get a question like this.

As for (c), that would only be true if getAppraisedValue() is declared abstract, or if the Mortgagable class were declared abstract. If that is the case, then one of (a) or (b) might be false.

Report this post to a moderator | IP: Logged

Old Post 02-19-2002 10:13 AM
Stephen Hosking is offline Click Here to See the Profile for Stephen Hosking Click here to Send Stephen Hosking a Private Message Find more posts by Stephen Hosking Add Stephen Hosking to your buddy list Edit/Delete Message Reply w/Quote
sby
Junior Member

Registered: Nov 2001
Location:
Posts: 16

Hi cotiyal,

The answer is B and C.

The picture is a little bit different than you described.
Classes X and Y implement Mortgageable interface - the dashed line with an arrowhead and <<interface>> just above "Mortgageable".
So A is incorrect - they are not SUBCLASSES, they implement an interface.
As they implement this interface they MUST implement getAppraisedValue() method defined by this interface - C is correct.
B is also correct. Instances of X and Y can be passed as a parameter described as Mortgageable because they implement Mortgageable.
D cannot possibly be correct there could not be instances of interface.

Regards

Report this post to a moderator | IP: Logged

Old Post 02-21-2002 10:34 PM
sby is offline Click Here to See the Profile for sby Click here to Send sby a Private Message Find more posts by sby Add sby to your buddy list Edit/Delete Message Reply w/Quote
Stephen Hosking
Member

Registered: Nov 2001
Location:
Posts: 54

Agreed. (b) and (c)

That settles it - if Mortgeable is an interface then (a) is wrong, and (b) and (c) are both true.

Report this post to a moderator | IP: Logged

Old Post 02-22-2002 02:45 AM
Stephen Hosking is offline Click Here to See the Profile for Stephen Hosking Click here to Send Stephen Hosking a Private Message Find more posts by Stephen Hosking Add Stephen Hosking to your buddy list Edit/Delete Message Reply w/Quote
gripusa
Junior Member

Registered: Dec 2003
Location: pakistan
Posts: 6

I have got this question and yes it is an interface, so its answers are b and c.

As we can use interface as common parameter and it also imposed a restriction that implementing classes should implement the feature.

__________________
director
GripSoft

Report this post to a moderator | IP: Logged

Old Post 12-28-2003 09:23 AM
gripusa is offline Click Here to See the Profile for gripusa Click here to Send gripusa a Private Message Find more posts by gripusa Add gripusa to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 04:28 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 

< Contact Us - Objects by Design >

Powered by: vBulletin Version 2.3.5
Copyright ©2000 - 2018, Jelsoft Enterprises Limited.
Copyright 1999-2005, Objects by Design, Inc.