An operator is a member that defines the meaning of an expression operator
that can be applied to instances of
the class. Operators are declared using operator-declarations:
operator-declaration:
attributesopt operator-modifiers operator-declarator operator-body
operator-modifiers:
operator-modifier
operator-modifiers operator-modifier
operator-modifier:
public
static
extern
operator-declarator:
unary-operator-declarator
binary-operator-declarator
conversion-operator-declarator
unary-operator-declarator:
type operator overloadable-unary-operator ( type identifier )
overloadable-unary-operator: one of
+ - ! ~ ++ -- true false
Chapter 17 Classes
255
binary-operator-declarator:
type operator overloadable-binary-operator ( type identifier , type
identifier )
overloadable-binary-operator: one of
+ - * / % & | ^ << >> == != > < >= <=
conversion-operator-declarator:
implicit operator type ( type identifier )
explicit operator type ( type identifier )
operator-body:
block
;
There are three categories of overloadable operators: Unary operators (§17.9
.1), binary operators (§17.9.2), and
conversion operators (§17.9.3).
When an operator declaration includes an extern modifier, the operator is
said to be an external operator.
Because an external operator provides no actual implementation, its
operator-body consists of a semi-colon. For
all other operators, the operator-body consists of a block, which specifies
the statements to execute when the
operator is invoked. The block of an operator must conform to the rules for
value-returning methods described in
§17.5.8.
The following rules apply to all operator declarations:
? An operator declaration must include both a public and a static modifier.
? The parameter(s) of an operator must be value parameters. It is a
compile-time error for an operator
declaration to specify ref or out parameters.
? The signature of an operator (§17.9.1, §17.9.2, §17.9.3) must differ
from the signatures of all other operators
declared in the same class.
? All types referenced in an operator declaration must be at least as
accessible as the operator itself (§10.5.4).
? It is an error for the same modifier to appear multiple times in an
operator declaration.
Each operator category imposes additional restrictions, as described in the
following sections.
Like other members, operators declared in a base class are inherited by
derived classes. Because operator
declarations always require the class or struct in which the operator is
declared to participate in the signature of
the operator, it is not possible for an operator declared in a derived
class to hide an operator declared in a base
class. Thus, the new modifier is never required, and therefore never
permitted, in an operator declaration.
Additional information on unary and binary operators can be found in §14.2.
Additional information on conversion operators can be found in §13.4.
分享到:
相关推荐
Teradata SQL Functions, Operators, Expressions, and Predicates
Restriction Operators Projection Operators Partitioning Operators Join Operators Concatenation Operators Ordering Operators Grouping Operators Set Operators Conversion Operators Equality ...
Dunford,Schwartz写的线性算子。
内容涉及:cdo(climate data operators)的说明书、指令卡片、图形使用文档、py和rb对cdo的使用以及一个大佬的相关ppt。之前发过一个链接,只有py和rb对cdo的使用,这边这个涵盖了我最近找到的所有参考文档。
Schrodinger Operators With Application to Quantum Mechanics and Global Geometry (Theoretical and Mathematical Physics) by Hans L. Cycon, Richard G. Froese, Werner Kirsch, Barry Simon (z-lib.org).djvu
微分方法求解Retinex算法,A unifying retinex model based on non-local differential operators
r6运算符 r6operators是Node.js的高质量矢量化Rainbow 6:Siege Operator图标和元数据的集合。 这个项目的开始是人们获得“彩虹六号:围攻”操作员的高分辨率操作员图标的一种方式,尤其是随着近年来矢量图形在Web...
介绍.NET Standard Query Operators
This book should be useful for readers who are interested in the question Why and how something happened. Furthermore, it may serve as a reference and guide for beginners who want to learn Banach ...
I get asked this question sometimes from seasoned programmers who are new to C++. There are plenty of good books written on the subject, but I found no clear and concise set of rules on the Internet ...
小波与算子 ,是小波领域权威书籍,适合研究小波的学者。
Evolutionary computation
适合入门的泛函分析类书籍,由浅入深,有大量应用和例子,
Lecture Notes in Mathematics Edited by A. Dold and B. Eckmann Applications to Partial Differential Equations
JSON Functions And Operators.md
《如何编写Operator》Operator 模式旨在捕获(正在管理一个或一组服务的)运维人员的关键目标。 负责特定应用和 service 的运维人员,在系统应该如何运行、如何部署以及出现问题时如何处理等方面有深入的了解。...
关于微分算子的一些公理性结果
安装yarn add -D eslint-plugin-no-mixed-operators 要么npm install --save-dev eslint-plugin-no-mixed-operators用法像常规插件一样使用它,并禁用原始插件(如果已启用)。 // .eslintrc{ "plugins" : [ "no-...
standard_query_operatorsstandard_query_operators
Calder'on-Zygmund 算子的交换子的加权端点估计,梁熠宇, KY LUONG DANG,设 $deltain(0,1]$, $T$ 是一个 $delta$-Calder'on-Zygmund 算子.设 $w$ 属于 Muckenhoupt 权类 $A_{1+delta/n}({mathbb R}^n)$, 满足$int_...