Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > C++ > Coding

Coding - Page 3

41-60 of 525     Previous     Next
A Powerful and Simple Message Box Statement
by Andreas Hillqvist
This tip can be used as a Select Case statement with a MsgBox statement. Because a variable is not used to hold the response, adding one or more handles for response is easy. The statement ...
Use Resource File to Manage Strings for Multi-lingual Applications
by David Chu
By using resource file, strings used by controls or message windows can be converted to different language strings in your application. The VB 6 Resource Editor allows the addition of ...
Covariant Template Parameters
by Danny Kalev
Suppose you need to define a function that takes a vector object and performs certain operations on it. The function has to be generic, that is, it should handle all instances of std::vector in ...
extern "C" Declarations of static Member Functions
by Danny Kalev
One of the issues that have been discussed at the C++ standards committee is whether the declaration of static member functions is permitted. For ...
Function Object Bases
by Danny Kalev
To simplify the process of writing custom function objects, the Standard Library provides two classes that serve as base classes of such objects: std::unary_function and std::binary_function. ...
Null Handling in VB6
by Nazmul Siddiqui
A simple way to get around having to handle Nulls in fields from recordset is to concatenate a zero length string at the end of the field value, as illustrated in the following ...
Qualified Calls
by Danny Kalev
A function call such as the ...
auto_ptr and Derived Objects
by Danny Kalev
The auto_ptr<> class template respects polymorphism and destroys derived objects of base pointers properly. In the following program, an auto_ptr<A* > is actually bound to a B * pointer, where ...
Returning a Value from a Function that Throws
by Danny Kalev
A reader asked me the following questions: "Can a function that returns something, throw a exception and still return a value?" Lets' look at a concrete ...
Creating Constructors
by Kristensen Ole
In the coming Visual Studio 7, it is possible to create constructors in VB. One of the great benefits of using constructors is that they make it possible to control the initial state of a class. ...
Error Message Passing Throughout Nested Components
by Peter Luo
Nowadays, components are popularly used in VB projects. These components can sometimes make it hard to determine which component has an error when the application stops running. This is ...
Passing Objects in a Function
by Kumar Gaurav
In Java, objects are passed to a function by reference, so you can manipulate the object data in the function and have that reflected outside the function also. If you try to swap the values of ...
Old-style Function Declarations
by Danny Kalev
In earlier stages of C, function declarations looked like ...
Factorial Function
by Danny Kalev
One of the classic examples of using recursion is calculating a factorial of a number. Here's a typical implementation of this ...
Basic Event Logging
by Bob Feldsien
Any production application should include event logging for troubleshooting and auditing purposes. This code can be placed in any module and called whenever you have an error or event that you ...
Don't Use const for Passing Parameters by Value
by Danny Kalev
To avoid undesirable changes to an argument passed by reference, you pass it as a const parameter. For ...
Invoking a Function Through a Pointer
by Danny Kalev
When you call a function through a pointer to function, use that pointer as if it were the function itself, not a pointer. For ...
Error Handling and Corrections
by Davis Chu
The following is an example to handle errors in VB. It combines "On ...
Methods of Class Instantiation
by Mahesh Chulet
The following methods can be used for creating new instance of your classes, depending on your specific needs. ...
Returning Aggregates from a Function
by Danny Kalev
Both C and C++ allow you to return by value aggregates, e.g., structs and unions, from a function. However, the runtime overhead of returning large objects by value can be significant. This is why ...
41-60 of 525     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date