1. C# / Говнокод #25330

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    using System;
    using var = innerx.var_;
     
    namespace innerx {    
        public class var___ : var
        {
            public var var => new var();
        }    
        public class var__ : var
        {
            public var___ var() => new var___();
        }
        public class var_ {
            public static readonly var__ var = new var__();
            public override string ToString() => "var";
        }
    }
     
    public class foo {
        public static void Main() {
            var var = var.var.var().var;
            Console.WriteLine(var);
        }
    }

    https://ideone.com/2N2MOU

    Запостил: cykablyad, 27 Января 2019

    Комментарии (8) RSS

    • Варварство!
      Ответить
    • Два решения на "PHP". Первое:
      <?php
      
      class var___ extends var_ {
          public function __get ($name) {if($name === 'var') return new var_();}
          public function __isset ($name) {return $name === 'var';}
      }    
      
      class var__ extends var_ {
          public function __get ($name) {if($name === 'var') return function() {return new var___();};}
          public function __isset ($name) {return $name === 'var';}
      }
      
      class var_ {
          public function __get ($name) {if($name === 'var') return new var__();}
          public function __isset ($name) {return $name === 'var';}
          public function __toString() {return 'var';}
      }
      
      $var = new var_();
      $var = $var->var->var; 
      $var = $var()->var;
      
      print($var);


      Второе:
      <?php
      
      class var___ extends var_ {
          public function __get ($name) {if($name === 'var') return new var_();}
          public function __isset ($name) {return $name === 'var';}
          public function __invoke() {return $this;}
      }    
      
      class var__ extends var_ {
          public function __get ($name) {if($name === 'var') return new var___();}
          public function __isset ($name) {return $name === 'var';}
      }
      
      class var_ {
          public function __get ($name) {if($name === 'var') return new var__();}
          public function __isset ($name) {return $name === 'var';}
          public function __toString() {return 'var';}
      }
      
      $var = new var_();
      $var = $var->var->var;
      $var = $var()->var;
      
      print($var);
      Ответить
    • Ну, такое
      struct derived {
         explicit derived() = default;
         int override() const { return 0; }
      };
      
      using override = derived;
      
      int main()
      {
          override override;
          return override.override();
      }
      Ответить

    Добавить комментарий