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 are register variables?
List the features of oops in c++?
What are c++ data types?
What is recursion?
What is late binding c++?
Write an algorithm that determines whether or not an almost complete binary tree is a heap.
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
What is c++ prototype?
What is overloading unary operator?
Write a program to find the Factorial of a number
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
What is the most powerful coding language?
When can I use a forward declaration?
Can member functions be private?
What is a lambda function c++?