Indexer (programming): Difference between revisions

Content deleted Content added
Dmt137 (talk | contribs)
m C++: wording
WikiCleanerBot (talk | contribs)
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
Line 4:
== Implementations ==
=== C++ ===
In C++ one can emulate indexing by overloading the {{c++|[]}} operator. The expression {{c++|a[b...]}} translates to a call to the user-defined function {{c++|operator[]}} as {{c++|(a).operator[](b...)}}.<ref>{{cite web|url=https://en.cppreference.com/w/cpp/language/operators|title=C++ operator overloading}}</ref>. Here is an example,
<syntaxhighlight lang="c++">
struct vector{
Line 98:
 
=== PHP ===
In PHP indexing can be implemented via the predefined {{python|ArrayAccess}} interface,<ref>{{cite web|url=https://www.php.net/manual/en/class.arrayaccess.php|title=PHP ArrayAccess interface}}</ref>,
<syntaxhighlight lang="php">
<?php