Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IS-A and HAS-A relationship

 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(from k&b book from pg.94)



i suppose actually here they have used halter(in 1) like any basic variable declarationthis is also a derived declaration of type halter class.My doublt is that just by declarig "private halter myHalter;" weather an object is created .What is (LeadRope rope) (2).is LeadRope a class name or it is an object for class named "LeadRope).please do clarify my doubts.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12085
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, no object is created until you see the word "new" somewhere (with a few exceptions).

the line "public void tie(LeadRope aRope)" is a method declaration. you are saying "give me a method that anyone can call (public), that doesn't return any value back to the caller (void), and name it "tie". the caller of the method must pass it a reference to LeadRope object, and within this method, that passed in reference will be called "aRope".
 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thankyou fred
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic