Difference between "self" in Obj-C and "this" of Java


#1

Hello,

it’s clear from the title are they equivalent ? is there any difference between self “obj-c” and “this” java and if we can still use “this” in objective-c to call the current object and to call instance variable like this.width for exemple , thank you for your answer in advance

Annonces en Tunisie


#2

Java and Objective-C are entirely different languages.

Yes it is true that the meaning of this and self are equivalent, they are not syntactically equivalent.

In Objective-C an object can access the values of its properties with self.SomeProperty.

You can easily discover this yourself by creating a toy project to experiment with anything you can think of; it is easy to do and you can not set off a nuclear reaction.


#3

Thank you for your answer :slight_smile: it’s clear now

Annonces en Tunisie