
Placement New Objects Must be Destroyed Explicitly
Objects constructed on a pre-allocated buffer by using placement new must be destroyed explicitly. #include #include using namespace std;class C{public: C() { cout

Objects constructed on a pre-allocated buffer by using placement new must be destroyed explicitly. #include #include using namespace std;class C{public: C() { cout

The compiler ignores the access specifier of friend functions. However, you should declare them as public to make the code readable: bool operator ==( const Date & d1, const Date&

You can create selection box options dynamically using JavaScript 3.0’s Option object. The syntax for its constuctor is: Option(text, value, [default selected], [selected]) Here is an example: Related Posts Singaporean

Some programmers tend to add an empty exception specification to constructor destructor, assignment operator, and copy constructor of a class: class C {public: C() throw(); ~C() throw(); C(const C&) throw();

When you open VB5’s Components list, you’ll see many controls and libraries not available for your development. Some are controls you downloaded from Web pages; others come from who knows

For some enum types, it may be useful to define overloaded operators, such as ++ and –, that can iterate through the enumerator values: #include using namespace std;enum Days {Mon,

A class may have const and reference data members. These members must be explicitly initialized by a member-initialization list: class Allocator{private: const int chunk_size; const string & serialization_path; // file

A single object, employing a single set of event routines, may be used across all pages in the SSTab control. Draw the object on the form that contains the SSTab

It can be useful to create generic controls of similar properties. For example, if a project has 10 textboxes on different forms that need to accept numeric input only, instead

Use this quick and dirty routine to help find empty recordsets: Public Function IsEmptyRecordset(rs As Recordset) As Boolean IsEmptyRecordset = ((rs.BOF = True) And (rs.EOF = True))End Function Related Posts

When working with or fixing Access databases and Excel spreadsheets created by users at my company, I often have to use their strings from the table or spreadsheet to save

Question: I am trying to work out the coding to execute a file that I select in my filelistbox in Delphi 4. Can you help me? Answer: You can refer

Question: Is there a way to share a database session between calling application and DLL? Not having such a sharing (DLL with DataSet components) increases the number of SQL server

Question: How do I read the last character in a DBEdit box and get its ASCII value? The character will change, depending on the DBEdit.Text property. Answer: You can use

Question: I commissioned a program that was written in Delphi. I am not a programmer, but an excellent hacker. Is there any way I can get into this program to

Question: I work with a Paradox and a MSQL database and I need to transfer data from the Paradox to a temporary table with a scope (create table #Table_name). I

Internet Explorer version 5 has significantly better HTML table support than previous versions. Up until now, HTML writers have had to rely on trial and error to make tables render

You may come across some situations where implementing a Runnable may have some advantages over extending Thread. If the class you are going to multi-thread is already extending another class,

C++ allows you to declare variables just before their use rather than at the top of the enclosing block. Thus, it is legal to declare a variable inside the condition

Question: How do I read a file on the A: drive into my program and then display the contents into an edit box? Answer: I’m not sure you’d want to

Question: I am having troubles with the TTreeView component and adding custom derivations of TTreeNodes to it. I want to define a new type of TTreeNode with a lot of

Question: How do I refresh the desktop after I draw on it? Answer: Simple: call the Invalidate method for your form, and the window will refresh. Related Posts Making a

Question: I’m having problems passing variables to an API function. I always receive a Type mismatch error. I reproduced the situation in Visual Basic and found that if I used

Question: Is it possible to have two different versions of the Borland Database Engine (BDE) installed on the same machine? I’ve been developing in Delphi 3, recently went to Delphi

Question: I am updating an application that was developed to make an executable test version. However, the live database is opened, not a test database. I have made a test

If you have a Microsoft Word document that you want to insert into an HTML page in FrontPage 98, you don’t have to open Word to convert to HTML. With

In general, classes that possess pointers, file handles, and other resources need a user-defined constructor to avoid aliasing. For example: class Person {private: int age; char * name;public: // the

An event producer is also known as the “source” of the event. Java does not define a base class or an interface for the event producer. However, the Listener design

The EventListener interface is a marker or tag interface that doesn’t define any methods. Its purpose is to provide a base interface for all event listener objects that follow the

If you have Simple Mail Transfer Protocol (SMTP) installed with Internet Information Server (IIS), you can automate e-mail through VBScript. The Collaboration Data Objects for Windows NT Server (CDONTS) component