Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
Search the Tips
Tip Bank > C++ > Overloading

Overloading - Page 2

21-36 of 36     Previous     Next
Restrictions on Operator Overloading
by Danny Kalev
The following restrictions apply to operator overloading: ...
Access Specification of a Virtual Method Should not Change in a Derived Class
by Danny Kalev
The access specification of a public virtual member function defined in a base class, can be changed in a derived ...
Prefix Versus Postfix Operators
by Danny Kalev
You can use both -- and ++ as prefix and postfix operators. When applied to primitives such as int or char, they are indistinguishable in terms of efficiency. When applied to objects, on the other ...
Function Overloading
by Danny Kalev
In order to overload a function, a different signature should be used for each overloaded version. A function signature consists of the list of types of its arguments as well as their order. Here's a ...
Simulating Inheritance of Assignment Operator
by Danny Kalev
As opposed to base class' constructor and destructor, which are automatically invoked from the derived class' constructor and destructor respectively, a user-defined assignment operator defined in a ...
Beware of Aliasing
by Danny Kalev
Whenever your class contains pointers, references, or handles, you need to define a copy constructor and assignment operator. Otherwise, the compiler-generated copy constructor and assignment ...
Use private copy constructor and assignment operator to avoid object copying
by Danny Kalev
If you don't want users of your class to be able to assign objects of its type (password string objects are a good example), you can declare a private assignment operator and copy constructor. Please ...
Consistent operator overloading
by Danny Kalev
Whenever you overload operators such as + or -, it is useful to support the corresponding += and -= as well. As opposed to a common belief, the compiler will not do that for you ...
Hiding a base class member function
by Danny Kalev
A derived class may hide a member function declared in its base class by using the same function name, but with a different signature, or list of arguments. Usually, this case suggests a programmer's ...
Assignment operator is not inherited
by Danny Kalev
Unlike ordinary base class member functions, assignment operator is not inherited. It may be re-defined by the implementer of the derived class or else it is automatically synthesized by the ...
Overloading postfix and prefix ++
by Danny Kalev
For primitive types the C++ language distinguishes between ++x; and x++; as well as between --x; and ...
vector<> members must define < and == operators
by Danny Kalev
The STL vector<>, as well as other standard containers, support comparison and sorting of their members by calling the corresponding standard functions found in the <algorithm> header ...
One more thing to remember when defining copy constructor and operator=
by Danny Kalev
Assigning an object to itself is disastrous, so whenever you have to define a copy constructor and assignment operator, make sure your code is guarded from such a ...
Operator overloading rules of thumb
by Danny Kalev
When overloading an operator to support a user-defined type (object), it is best to adhere to the basic semantics of that built-in operator. For instance, the built-in operator ==, which does not ...
Overloading the assignment operator "="
by DevX Pro
I am puzzled at the way in which the assignment operator is overloaded in C++. Would you please show an example as to what efficient code for overloading this operator would look like. Specifically, my confusion is about how this function would copy old resources into new resources before return *this.
Overloading the inserter and extractor operators
by DevX Pro
I would like to see examples of overloading the inserter and extractor operators.
21-36 of 36     Previous     Next
Sitemap