G
Guest
Now... so in Java, Python, PHP5, and Ruby, it looks like they are all
pointers when you say
a = new Dog("woofy")
or
a = Dog.new("woofy")
so they are all pointers, not reference. (because reference cannot
point to a different thing after it is set, like a = new Dog("lulu")
or a = nil)
I do not know, but at least in Java they are references, and I think
that they use the same terminology in the other languages you mentioned.
the syntax a.color or a.bark is just a simpler way of writing C or C
++'s "->"
Not necessarily, that depends on the semantics used in the language in
question. Just a guess but I would suspect that there are subtle
differences between references in all those languages.
so that's it? I tend to compare the "." and the "->" as I view the
relatively modern language having similar syntax or operators...
(didn't expect "." to mean "->" in another language)
Please try to separate different languages. Just because some concepts
have the same name in more than one language and share some
commonalities does not mean that they are the same thing or that they
can be easily explained in terms of some other language (unless you go
down to assembly level.
Just realise that a C/C++ pointer is not a C++ reference is not a Java
reference is not a C# reference, and so on. A Java reference is a Java
reference, nothing more nothing less, just like a C++ reference is a C++
reference, not a pointer or something else, it is just a reference.