durga


{ City }
< Country > india
* Profession *
User No # 57812
Total Questions Posted # 11
Total Answers Posted # 6

Total Answers Posted for My Questions # 19
Total Views for My Questions # 60982

Users Marked my Answers as Correct # 21
Users Marked my Answers as Wrong # 4
Questions / { durga }
Questions Answers Category Views Company eMail

How to detect memory leaks in c++

Mphasis,

1 C++ General 4369

What is ambiguity in c++

Accenture, Mphasis,

4 OOPS 20437

why the memory allocated with new cant be freed using free()

2 OOPS 3915

What are the fields of vtable

Mphasis,

1 OOPS 3705

What are the popular tools used to detect memory leaks in c++

TATA,

4 C++ General 5946

What is the difference between pass by value,pass by pointer,pass by reference in the catch block in the exception handling in c++

TCS,

1 OOPS 3734

how does the UIThread and worker thread communicates and handle events

HCL,

2 MFC 6477

when to use 'mutable' keyword and when to use 'const cast' in c++

TCS,

OOPS 1633

why reinterpret cast is considered dangerous?

TCS,

OOPS 1884

What are callback functions in c++

SoftTech,

1 OOPS 3647

How to call a non virtual function in the derived class by using base class pointer

HCL,

3 OOPS 5235




Answers / { durga }

Question { 3915 }

why the memory allocated with new cant be freed using free()


Answer

new keyword does two things.
1) allocate memory using new operator
2) invokes the constructor.

so the allocated memory using new should be freed only by
delete which frees the memory by calling the destructor.

But free will not do these things.

Is This Answer Correct ?    3 Yes 0 No

Question { 4082 }

Difference between vector and array


Answer

Vector manages memory allocations, manages in the sense, it
provides constructor,copy constructor,assignment operator,
destructor etc. whereas array doesn't.

Is This Answer Correct ?    0 Yes 1 No


Question { 3792 }

Why is it so that we can have virtual constructors but we
cannot have virtual destructors?


Answer

We can have Virtual Destructor. We cannot have virtual
constructor, becoz, if the constructor is virtual, in
polymorphism, there may be a chance for the base class
constructor not to get executed. so the entire class will
not be available.

Is This Answer Correct ?    11 Yes 0 No

Question { 3290 }

what is namespace? what are the uses of namespace?


Answer

Namespaces allow to group entities like classes, objects
and functions under a name. This way the global scope can
be divided in "sub-scopes", each one with its own name.
The format of namespaces is:
namespace identifier
{
entities
}
Where identifier is any valid identifier and entities is
the set of classes, objects and functions that are included
within the namespace. For example:
namespace myNamespace
{
int a, b;
}
In this case, the variables a and b are normal variables
declared within a namespace called myNamespace. In order
to access these variables from outside the myNamespace
namespace we have to use the scope operator ::. For
example, to access the previous variables from outside
myNamespace we can write:
myNamespace::a
myNamespace::b

The functionality of namespaces is especially useful in the
case that there is a possibility that a global object or
function uses the same identifier as another one, causing
redefinition errors. For example:
// namespaces
#include
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main () {
cout << first::var << endl;
cout << second::var << endl;
return 0;
}
5
3.1416
In this case, there are two global variables with the same
name: var. One is defined within the namespace first
and the other one in second. No redefinition errors happen
thanks to namespaces.

Is This Answer Correct ?    0 Yes 0 No

Question { Syntel, 5155 }

WHAT IS THE DIFFERENCE BETWEEN C++ AND VC++


Answer

VC++ uses all C++ features.VC++ has GUI and it is user
friendly.It has many programming features
likeWin32,MFC,ATL,ActiveX,DLL's etc.

Is This Answer Correct ?    0 Yes 3 No

Question { 3690 }

what are abstract classes and how they impliment , with
example


Answer

A class with atleast one pure virtual function is called
abstract class.It cant be instatiated.It can be used as a
base class for other classes. The class derived from an
abstract base class can be instantiated,provided it should
implement the abstract base class pure virtual function.

Is This Answer Correct ?    7 Yes 0 No