devxlogo

Tip Bank

String Objects and C-strings: Caveats

The standard string class has a dual interface: it supports both C-style strings as well as string objects in various operations: const char text[] = “hello world”;string s = text;

Function Overloading

In order to overload a function, a different signature should be used for each overloaded version. A function signature consists of the list of types of its arguments as well

Pre-Defined Macros

All C/C++ compilers define the following macros: __DATE__ //a literal containing the compilation date in the form “Apr 13 1998″__TIME__ //a literal containing the compilation time in the form “10:01:07″__FILE__

Prefer dynamic_cast<> to typeid()

A robust, long lasting OO design relies on the premise that an existing class can be re-used in the future by means of derivation. Therefore, examining the actual type of

Simulating Inheritance of Assignment Operator

As opposed to base class’ constructor and destructor, which are automatically invoked from the derived class’ constructor and destructor respectively, a user-defined assignment operator defined in a base class is

<SPAN> Attribute in IE

Question: I’ve been working on completely redoing my company’s Web site for over a month and a half now. To help me out, I bought a book on HTML 4.0

Approach to studying C++

Question: My development background primarily involves COBOL and BASIC on UNIX platforms. I decided to further my language knowledge and branched out into C & C++. I’ve largely been teaching

InetAddress to String

Question: Is it possible to convert from java.net.InetAddress to string? Answer: Yes. Just call the InetAddress toString() method. Also, if you specifically want the host name, use getHostName. If you

Year 2000 and C++

Question: I am urgently looking for information regarding Year 2000 compliancy for Borland’s C++ compilers, esp. versions 3.1 and 4.02. Answer: I can’t imagine anything about C++ or the compiler