Note that there are some explanatory texts on larger screens.

plurals
  1. POStatic polymorphism definition and implementation
    primarykey
    data
    text
    <p>I have some questions about the concept of <em>static polymporhism</em> I somethimes hear about; you may interpret them primarily in the context of C++, but I'd appreciate language-agnostic answers where applicable (<em>hence tagging both C++ and language-agnostic</em>).</p> <ol> <li><p><strong>How do we <em>define</em> static polymorphism in general?</strong> As an example, I believe that the <code>std::sort</code> function from C++ shall be considered statically polymorphic as it depends on some interface provided by some objects which <em>behave like iterators</em>, and the <em>exact behaviour under the interface of provided iterators</em> can be determined in the compile-time. Is this explanation how we define static polymorphism, or is it just a description of a specific case and there's more to it?</p></li> <li><p><strong>What are the common code patterns</strong> of using static polymorphism in C++? Also: Is SP <em>only</em> achieved via templates in C++? </p></li> <li><p><strong>Is it true that</strong> a given UML class diagram doesn't <em>directly</em> describe how polymorphism is handled and, thus, it can be at least partially implemented either statically or dynamically? In other words: Is the choice of static vs dynamic polymorphism independent of the OOP model, and thus up to the implementor to decide?</p></li> <li><p><strong>Is static polymorphism only C++-specific</strong> and related to how templates work? If not, is it present in any other <em>mainstream languages</em> besides C++? Can we have an equivalent of static polymorphism in Java, C#.. anything, and will it bring any benefits?</p></li> <li><p>The most important... <strong>What are the actual benefits of using static polymorphism?</strong> I think we can agree that it reduces code flexibility; what are the advantages, besides - in the case of C++ - saving one pointer dereference (virtual function / pointer-to-function / delegate cost)? What is the <strong>class of problems</strong> where static polymorphism is especially useful, the right choice for implementation?</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload