A clear and unmarked challenge to the PLO?



  • Method issue Clear (sighs)explicit) and non- (sighs)implicitWhat are they different? If I understand correctly, it's like,

    obj.meth(x, y); 
    

    What's not gonna be a clear And what methods can't be clearly called?



  • Here's an example: PHP has a magic method. __toStringby implementing this method in the classroom, we point ourselves as a specimen of the class in the form of a line (string). When class object with certain method __toString In a context which suggests that work is proceeding with a line, it is not clear that magical method is involved. __toStringbefore taking other action on the target.

    class SomeClass {
    
    public function __toString() {
        return 'Hello World!';
    }
    

    }

    $a = new SomeClass();
    echo $a; // outputs 'Hello World!'

    In line echo $a; First, the method will not appear SomeClass::__toString()Although we clearly did not give such an instruction, and then it will be completed. echo

    There are many other examples from different languages, but I think the basic idea should be understood.

    UPD

    The obvious challenge of methods is forgiveness for taftology, you clearly indicate in your code what method and what arguments you want to call. The unmarked challenge is a compilator (or an interpreter) doing it for you.
    I haven't written anything on the C++ for a long time, so unfortunately I can't give an example of an unmarkable challenge to the method, but I may have remembered the best known and easy way to understand the C+++ example. thisan index to a copy of the class, all functions of the C++ class (except static) not apparent accept as an argument an index for a copy of the class in which the method is applied.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2