Tuesday, September 12, 2006

13_September_2006

Tips :
What is the difference between a bug,defect and an error?

Error: A human action that produces an incorrect result. Programmatically mistake leads to error. bug: An informal word describing any of the above. Deviation from the expected result. A software bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from working as intended, or produces an incorrect result. Bugs arise from mistakes and errors, made by people, in either a program's source code or its design. It is said that there are bugs in all useful computer programs, but well-written programs contain relatively few bugs, and these bugs typically do not prevent the program from performing its task. Defect:
Problem in algorithm leads to failure. A defect is for something that normally works, but it has something out-of-spec.

When should our destructor be virtual? (C++)
When someone will delete a derived-class object via a base-class pointer.
In particular, here's when we need to make our destructor virtual:

What special considerations are needed when forward declarations are used with member objects?
The order of class declarations is critical.
The compiler will give you a compile-time error if the first class contains an object (as opposed to a pointer to an object) of the second class.
For Example :
class Fred; // Okay: forward declaration
class Barney
{
Fred x; // Error: The declaration of Fred is incomplete
};
class Fred
{
Barney* y;
};

One way to solve this problem is to reverse order of the classes so the "used" class is defined before the class that uses it:

class Barney; // Okay: forward declaration
class Fred
{
Barney* y; // Okay: the first can point to an object of the second
};
class Barney {
Fred x; // Okay: the second can have an object of the first
};

News :
Brasilia: Four days ahead of his meeting with President Musharraf, Prime Minister Manmohan Singh made it clear on Tuesday that he would take up the question of foreign support for terrorism in India in his talks with the Pakistani leader. The two are scheduled to meet on the sidelines of the XIV Non-aligned summit in Havana for an unstructured interaction.
Quote of the day :
If one studies too zealously, one easily loses his pants. - Einstein

No comments: