Re: Association and depency

From: Daniel T. (postmaster_at_eathlink.net)
Date: 05/30/04


Date: Sun, 30 May 2004 14:35:46 GMT

In article <FSGic.19401$_o3.621107@bgtnsc05-news.ops.worldnet.att.net>,
 "bobsled" <sleding@sands.com> wrote:

>Daniel T. <postmaster@eathlink.net> wrote in message
>news:postmaster-0B8918.17392724042004@news4.west.earthlink.net...
>> "bobsled" <sleding@sands.com> wrote:
>>
>> > Would you please check the code example blow to see if Association and
>> > Dependency are represented correctly in code? Thank you very much!
>> >
>> > class License;
>> >
>> > class Car;
>> >
>> > class Driver
>> > {
>> > Car* hiscar;//ASSOCIATION - Driver is associated with Car
>> > public:
>> > void own(License* l) { l->getLicenseNumber(); } // DEPENDENCY
>> > }
>>
>> Driver is associated with License in the above code. We can tell because
>> Driver objects send messages to License objects. A dependency would be
>> more like:
>>
>> class Factory {
>> public:
>> Car* makeCar() { return new Car; }
>> };
>>
>> Here the Car class must exist in order for the Factory class to work,
>> howver the Factory objects send no messages to Car objects, they make no
>> demands on the Car interface.
>
>In what sense do you mean that "Car class must exist in order for the
>Factory class to work"? Because that "Factory" is for making objects of
>"Car"? However I do see "Factory" can "exist" without creating "Car"...

This particular factory is a car factory, as such the car class must
exist in order for the car factory to make cars.



Relevant Pages

  • Re: Re: Adaptive learning CPU
    ... Admit that there are "man made" systems that evolve. ... The "BLANK MAP" is sufficient to start the car in LHM ... it would reset to the factory default. ...
    (talk.origins)
  • Re: Superbird
    ... It was NOT used on any production Chrysler ... As for factory-available colors, I believe that all factory B-body ... If you want to see a full gamut of Superbirds, ... The nosecone and such was hung inside the car as it went ...
    (rec.autos.makers.chrysler)
  • Re: Low frequencies on a 6.5" sub?
    ... turn the resonating frequency down from the 160-250Hz ... What car? ... What were the factory engineers thinking? ... factory sub amp. ...
    (rec.audio.tech)
  • Re: Low frequencies on a 6.5" sub?
    ... turn the resonating frequency down from the 160-250Hz ... What car? ... What were the factory engineers thinking? ... factory sub amp. ...
    (rec.audio.tech)
  • Re: classes and interfaces
    ... Just remember that an interface is a contract of sorts. ... So, when your car class implements the iCar interface, you are saying ...
    (microsoft.public.dotnet.languages.vb)