Skip to content

Why I can't use "this" with "is" relation in Solidity? #2536

Answered by krakxn
Hiren879 asked this question in Q&A
Discussion options

You must be logged in to vote

In Solidity, there is no such usage of this. this, in Solidity, means the specific instance of the contract being referenced (as a contract can have multiple instances). On type casting this via the datatype address, we get address(this) -- this means the address of the previous instance. Put simply, address(this) is how a contract references itself (its address, whereas this for the instance).

The above (address(this)) is precisely how we "pay" contracts.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@krakxn
Comment options

@alymurtazamemon
Comment options

Answer selected by Hiren879
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants