Jump to content


Photo

Beehive "this." Syntax Question


  • Please log in to reply
2 replies to this topic

#1 kinwolf

kinwolf

    New Member

  • Members
  • Pip
  • 2 posts

Posted 27 February 2014 - 10:51 AM

Hi,

In the beehive solution, page 284(3rd edition) why use this.shiftsToWork = numberOfShifts instead of simply stating shiftsToWork = numberOfShifts

I don't see why "this" has to be used here. Am I missing something?

Thanks!

#2 AndrewStellman

AndrewStellman

    Andrew Stellman

  • O'Reilly Author
  • PipPipPipPipPipPipPipPipPipPipPip
  • 815 posts
  • Gender:Male
  • Location:Brooklyn, NY
  • Interests:Author of: "Head First C#", "Beautiful Teams", "Head First PMP", "Applied Software Project Management"

Posted 28 February 2014 - 12:34 PM

Wow, nice catch! No, you're not missing anything, that 'this' is extraneous. The funny thing is that was there in the second edition, too. Thousands and thousands of people have seen that code, but I think you're the first person to notice it. Good work!

Andrew


Andrew Stellman
Author, Head First C#
Building Better Software -- http://www.stellman-greene.com

#3 kinwolf

kinwolf

    New Member

  • Members
  • Pip
  • 2 posts

Posted 01 March 2014 - 12:17 PM

Wow, nice catch! No, you're not missing anything, that 'this' is extraneous. The funny thing is that was there in the second edition, too. Thousands and thousands of people have seen that code, but I think you're the first person to notice it. Good work!

Andrew



Glad I wasn't crazy and that it seems I'm actually understanding something :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users