devxlogo

Tip Bank

Static member function

A static member function in a class can access only other static members of a class or variables which are not members of its class. It can be invoked even

Retrieving actual object type in run-time

C++ supports Run-time Type Identification (RTTI), which enables detection of actual object type during program execution using the built-in typeid() operator. Here is an example: //file: classes.hclass base{ base(); virtual

Global objects construction and destruction

In object-oriented programming (OOP), global objects are considered harmful. Particularly in C++, there’s even more reason to think twice before using them: a global object construction occurs before a program’s

When is a mem-initializer required?

A const member or a reference member cannot be initialized within an object’s constructor. Instead, they must be initialized in the constructor’s member-initializer list. Conceptually, mem-initialization takes place before the

Uses of an anonymous union

Unions are used to minimize memory waste. For example, consider the following database-transaction class used to update a person’s data. The key can be either a unique ID number or

Client Licensing

Question: What is the most cost-effective engine and method for licensing clients in client/server applications? Answer: For PowerBuilder applications, the runtime license for clients is free. You can have a

Draw order of dynamic datawindow objects

Question: How can I control the draw order (i.e., BringToFront, SendToBack) of datawindow objects dynamically created in the deatil band? Answer: At design time you can layer objects by using