Why some methods have ' :: '

Asked

Viewed 89 times

1

Why some methods like Perl or Ruby: Net::FTP, has these two points; how is the construction of the methods of this class and why is created in this way (with this syntax) and not in the way used by current libraries: HTTParty.get(), requests.get()?

1 answer

3


This has nothing to do with method but with class and yours namespace. FTP is the class and in it will contain methods. Net is only the surname of this class. Namespaces are like modules that contain class, but not exactly. In some languages it is confused with a package of classes that has a slightly different concept, the exact way of each language should be seen in its documentation.

Has an explanation of How namespaces work in C#?. The language chose to use the dot to namespaces also, but the idea is the same.

  • Thank you, I’ve seen namespace simple in C++ code over the internet but did not know the link you pointed out.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.