|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Couple of questions...All,
I have following question. 1. Difference between Has-A and IS-A relationship ? 2. What is exact difference between IComarable and ICompare interface ? silent ocean Answers:
1. HAS-A/IS-A allows you to determine relationships between classes. Example: Let's say you have 2 classes, Car and Driver the relationship between these two would be a HAS-A relationship. a Car HAS-A Driver, a Driver HAS-A car Now, without the Car the driver can still exist, he just doesn't have a car. on the same note, the car doesnt NEED a driver, it can exist without having a driver. So, a HAS-A relationship would be a relationship between the two classes, usually you have a member variable in one or the other that relates to the other class for access on the flipside, lets look at a IS-A relationship, this denotes Inheritance. Example: Let's say you have two classes, Shape and Circle. a Circle IS-A Shape, which would show us that Shape would be our base class, and Circle would be our derived class/inherited class. On a sidenote, an IS-A relationship shows that one class CANNOT exist without another. >From my understanding thats how it works, someone correct me if I am way off base here.Hello Deep,
DO> I have following question. DO> 1. Difference between Has-A and IS-A relationship ? http://en.wikipedia.org/wiki/Has-a http://en.wikipedia.org/wiki/Is-a DO> 2. What is exact difference between IComarable and ICompare DO> interface ? http://www.devcity.net/Articles/20/1/20020304.aspx http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/3f823331fe1eb204/7233f94b303577f1?lnk=st&q=IComparable+Icomparer&rnum=1#7233f94b303577f1 --- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche |
|||||||||||||||||||||||