Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between Message & Method  RSS feed

 
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: 17309
11
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
Ranch Hand
Posts: 15304
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!