This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between Message & Method

 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody here, who knows objective C tell the difference between Message & Method?

What I think is they both are same.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Semantics.

Objective-C doesn't call it methods. You send messages to an Object. The Object might or might not respond to the Message, which doesn't automatically cause it to fail. It can keep going.

In Java method calls, it can't keep going, either the class has the method or not, it is a compile time thing now.

Mark
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Spritzler wrote:Semantics.

Objective-C doesn't call it methods. You send messages to an Object. The Object might or might not respond to the Message, which doesn't automatically cause it to fail. It can keep going.


This is why if you try and access a method on an Objective-C object that doesn't exist, you simply get a "Foo may not respond to -bar" warning rather than an error. This is one of my least favorite things about Objective-C.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic