devxlogo

August 22, 2001

Avoid Unnecessary Constructors and Destructors

Some programmers consistently define an empty constructor and destructor in their classes, as in: class A{//..public: A() {} ~A() {}}; This is totally useless. C++ guarantees that when a class

Avoid Empty Member Initialization Lists

Following yesterday’s tip, here’s another deprecated habit that programmers should avoid. Consider the following class hierarchy: class base{public: base();};class derived: public base{public: derived() : base() {/*some code*/} // superfluous}; The

Quick and Easy Queue

Listboxes provide suitable functionality to act as a quick queue. Create a listbox named ListMyQueue. Use this code to add to your Queue: Public Sub Enqueue(StringToAdd As String)If Len(String_to_Add) >

Clear Structure Data With one Assignment

User-defined types are useful when you need to store structured data that has no specific behavior. If you have associated behavior, you should encapsulate the data in its own class.

Create Captionless MDI Forms

Sometimes you might want an MDI form without any captions or buttons, such as in a game or acting as a background parent object. You can create a captionless MDI

Drag Files Into Project Window

Creating a new project in VB6 (and earlier versions) has always been a pain when you have a large library of modules to add in. You can do it a