What is meant by ‘value semantics’, and what is meant by ‘implicit pointer semantics’?
What is meant by ‘value semantics’, and what is meant by ‘implicit pointer semantics’?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Java is using implicit pointer semantics for Object types and value semantics for primitives.
Value semantics means that you deal directly with values and that you pass copies around. The point here is that when you have a value, you can trust it won’t change behind your back.
With pointer semantics, you don’t have a value, you have an ‘address’. Someone else could alter what is there, you can’t know.
Pointer Semantics in C++ :
You need an * to ask for pointer semantics and -> to call methods on the pointee.
Implicit Pointer Semantics in Java :
Since you don’t have the choice of using value semantics, the * isn’t needed nor the distinction between -> and ., hence the implicit.