Skip to content

Commit

Permalink
Update noteworthy-differences.rst
Browse files Browse the repository at this point in the history
Added section (inspired by @carnaval) about C++ static dispatch vs. dynamic dispatch.
  • Loading branch information
ScottPJones committed May 5, 2015
1 parent 939fc81 commit 15068c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion doc/manual/noteworthy-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,7 @@ Noteworthy differences from C/C++
For example: ``@enum(Fruit, Banana=1, Apple, Pear)``
- By convention, functions that modify their arguments have a ``!`` at the end of the name,
for example ``push!``.

- In C++, by default, you have static dispatch, i.e. you need to annotate a function as virtual,
in order to have dynamic dispatch.
On the other hand, in Julia every method is "virtual" (although it's more general than that
since methods are dispatched on every argument type, not only ``this``, using the most-specific-declaration rule).

0 comments on commit 15068c1

Please sign in to comment.