comparison runtime/doc/vim9class.txt @ 33432:97ceabebaeaf v9.0.1974

patch 9.0.1974: vim9: using contra-variant type-checks Commit: https://github.com/vim/vim/commit/b32064fedbeb689ecb0481e9473cb7b87d5bb805 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Oct 2 21:43:58 2023 +0200 patch 9.0.1974: vim9: using contra-variant type-checks Problem: vim9: using contra-variant type-checks (after v9.0.1959) Solution: Use invariant type checking instead closes: #13248 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Mon, 02 Oct 2023 22:00:03 +0200
parents bb99820510ef
children 484543479bd7
comparison
equal deleted inserted replaced
33431:94a2ae015d9d 33432:97ceabebaeaf
545 545
546 Object variables from the base class are all taken over by the child class. It 546 Object variables from the base class are all taken over by the child class. It
547 is not possible to override them (unlike some other languages). 547 is not possible to override them (unlike some other languages).
548 548
549 *E1356* *E1357* *E1358* 549 *E1356* *E1357* *E1358*
550 Object methods of the base class can be overruled. The number of arguments 550 Object methods of the base class can be overruled. The signature (arguments,
551 must be exactly the same. The method argument type can be a contra-variant 551 argument types and return type) must be exactly the same. The method of the
552 type of the base class method argument type. The method return value type can 552 base class can be called by prefixing "super.".
553 be a covariant type of the base class method return value type. The method of
554 the base class can be called by prefixing "super.".
555 553
556 *E1377* 554 *E1377*
557 The access level of a method (public or private) in a child class should be 555 The access level of a method (public or private) in a child class should be
558 the same as the super class. 556 the same as the super class.
559 557