Saturday, March 3, 2007

Hi girls,

The following are the operators that can be redefined or can be overloaded in c++.

Redefinable Operators


Operator Name Type


, Comma Binary


! Logical NOT Unary


!= Inequality Binary


% Modulus Binary


%= Modulus assignment Binary


& Bitwise AND Binary


& Address-of Unary


&& Logical AND Binary


&= Bitwise AND assignment Binary


( ) Function call —


* Multiplication Binary


* Pointer dereference Unary


*= Multiplication assignment Binary


+ Addition Binary


+ Unary Plus Unary


++ Increment1 Unary


+= Addition assignment Binary


– Subtraction Binary


– Unary negation Unary


–– Decrement1 Unary


–= Subtraction assignment Binary


–> Member selection Binary


–>* Pointer-to-member selection Binary


/ Division Binary


/= Division assignment Binary


<>


<<>


<<= Left shift assignment Binary


<= Less than or equal to Binary


= Assignment Binary


== Equality Binary


> Greater than Binary


>= Greater than or equal to Binary


>> Right shift Binary


>>= Right shift assignment Binary


>= Greater than or equal to Binary


>> Right shift Binary


>>= Right shift assignment Binary


[ ] Array subscript —


^ Exclusive OR Binary


^= Exclusive OR assignment Binary

Bitwise inclusive OR Binary


= Bitwise inclusive OR assignment Binary



Logical OR Binary


~ One's complement Unary


delete Delete —


new New —

Friday, March 2, 2007

Virtual Functions..

Something I found interesting about the virtual functions..

VTABLE : It contains addresses of virtual functions. The compiler creates a VTABLE for each class that contains virtual functions and for classes that are derived from it. The VTABLE contains the addresses in the order in which virtual functions are defined within the class.

VPTR : It is the address of the VTABLE stored in the object.

Upcasting : It means storing the address of the derived class object in the base class pointer.

I hope it was useful in knowing more about virtual functions....