Answer Posted / atul shankhwar
Name mangling is the process through which your c++ compilers give each function in your program a unique name. In C++, all programs have at-least a few functions with the same name. Name mangling is a concession to the fact that linker always insists on all function names being unique.
Example:
In general, member names are made unique by concatenating the name of the member with that of the class e.g. given the declaration:
class Bar
{
public:
int ival;
...
};
ival becomes something like:
// a possible member name mangling
ival__3Bar
Consider this derivation:
class Foo : public Bar
{
public:
int ival;
...
}
The internal representation of a Foo object is the concatenation of its base and derived class members.
// Pseudo C++ code
// Internal representation of Foo
class Foo
{
public:
int ival__3Bar;
int ival__3Foo;
...
};
Unambiguous access of either ival members is achieved through name mangling. Member functions, because they can be overloaded, require an extensive mangling to provide each with a unique name. Here the compiler generates the same name for the two overloaded instances(Their argument lists make their instances unique).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the outcome of cout< a) 16 b) 17 c) 16.5
Write a c program for binary addition of two 8 bit numbers.
What is the difference between an external iterator and an internal iterator?
what are the events occur in intr activated on interrupt vector table
What is the C-style character string?
Differentiate between an array and a list?
Why main function is special in c++?
Why cout is used in c++?
What are the advantages of c++? Explain
What is namespace & why it is used in c++?
Is c++ a programming language?
What is polymorphism and its type in c++?
Is java made in c++?
Are there interfaces in c++?
What is the copy-and-swap idiom?