Tip Bank

DevX

Max Calculation

Question: How do you select the maximum value of a column in a DBGrid when displayed through a query? (query SQL:select max(CustNo) from customer, and get error message:”the table is

DevX

Error Creating Window

Question: In my Delphi 1.0 application, when I open a form (e.g. ClientForm.Show) I get an error message: “Error creating window.” This error occurs when several forms (nine or ten

DevX

Parameter Passing

Question: I am writing a program that needs to keep a running total of ID numbers allocated for this reason. The ID numbers are in an auto-increment field. I need

DevX

Multiple Inheritance

Question: I read somewhere that Object Pascal, the language used in Delphi, does not support multiple inheritance. Is this true? Answer: Yes, this is true. Object Pascal’s inheritance model follows

DevX

auto_ptr<>: your safe guard against memory leaks

The Standard Library supplies the class template auto_ptr which automatically deallocates heap memory. Likewise, local objects are reclaimed in case of exiting their scope or during “stack unwinding” caused by

DevX

extern “C” linkage declaration

It is not uncommon for C++ code fragments to be called by non-C++ programs such as a C-based communication software, COBOL based TP monitors and the likes. However, global functions

DevX

Exception-free version of operator new

Operator new throws an exception of type std::bad_alloc when it fails to allocate the requested amount of memory. Yet in some circumstances, or due to performance considerations, throwing an exception

DevX

That’s what friends are for

A class can declare external functions or other classes as friends. Friendship grants full access to all of the grantor’s members, even private and protected ones: void encrypt (string &

DevX

Quotes

Question: How do I display a quote through scripts? For example, I want to print the quotes in a line but JavaScript reads the quotes as part of the coding.