Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Not all of the above concepts are to be found in all object-oriented programming languages,
and so object-oriented programming that uses classes is called sometimes class-based
programming. In particular, prototype-based programming does not typically use classes.
As a result, a significantly different yet analogous terminology is used to define the
concepts of object and instance.
This is a list of operators in the C++ and C programming languages. All the operators
listed exist in C++; the fourth column 'Included in C', indicates whether an operator is also
present in C. Note that C does not support operator overloading.
When not overloaded, for the operators &&, ||, ?:, and , (the comma operator), there is a
sequence point after the evaluation of the first operand.
C++ also contains the type conversion operators const_cast, static_cast, dynamic_cast, and
reinterpret_cast which are not listed in the table for brevity. The formatting of these
operators means that their precedence level is unimportant.
Most of the operators available in C and C++ are also available in other languages such as
Java, Perl, C#, and PHP with the same precedence, associativity, and semantics.
Prefix
++a Yes Yes T1& operator++ (T1& a);
increment
Unary minus
-a Yes Yes T1 operator-(const T1& a);
(negation)
Prefix
--a Yes Yes T1& operator--(T1& a);
decrement
Postfix
a-- Yes Yes T1 operator--(T1& a, int);
decrement
Assignment
T1& operator-=(T1& a, const T1&
by a -= b Yes Yes b);
subtraction
Assignment
by T1& operator*=(T1& a, const T1&
a *= b Yes Yes b);
multiplicatio
n
Logical
negation !a Yes Yes bool operator!(const T1& a);
(NOT)
Assignment
T1& operator<<=(T1& a, const T2&
by bitwise a <<= b Yes Yes b);
left shift
Assignment
T1& operator>>=(T1& a, const T2&
by bitwise a >>= b Yes Yes b);
right shift
Bitwise one's
complement ~a Yes Yes T1 operator~(const T1& a);
(NOT)
Assignment
T1& operator&=(T1& a, const T2&
by bitwise a &= b Yes Yes b);
AND
Assignment
T1& operator|=(T1& a, const T2&
by bitwise a |= b Yes Yes b);
OR
Assignment
T1& operator^=(T1& a, const T2&
by bitwise a ^= b Yes Yes b);
XOR
Basic
a = b Yes Yes T1& T1::operator= (const T2& b);
assignment
Indirection
(dereference *a Yes Yes T2& operator* (T1& a);
)
Address-of
&a Yes Yes T2* operator& (T1& a);
(reference)
Bind pointer
to member a.*b No No N/A
by reference
ternary
a ? b : c No Yes N/A
conditional
Scope
a::b No No N/A
resolution
Pointer to
a::*b No No N/A
member
sizeof a
size-of sizeof(type)
No Yes N/A
Type typeid(a)
typeid(type)
No No N/A
identification
Allocate
new type Yes No void *T1::operator new(size_t x)
storage
Allocate
void *T1::operator new[](size_t
storage new type[n] Yes No x)
(array)