Which is the parameter that is added to every non-static
member function when it is called?
Answers were Sorted based on User's Feedback
Answer / manish kumar
(this) pointer is added.
this pointer contains the address of the object through
which function is called.
this->data member will give the data of the object.
| Is This Answer Correct ? | 49 Yes | 4 No |
Answer / arun
"this" (i.e. Pointer to the object which call the member
function) is passed as the argument when a member function
is called.
| Is This Answer Correct ? | 21 Yes | 1 No |
Ex:
class Employee{
public:
int member_Function1(){}
void display()
{
do something;
}
};
int main()
{
Employee e1;
e1.member_Functiuon(int a, int b);------> refer below
1...
}
1...
Here e1 is an object of Employee Class.
Now e1.member_Function(int a, int b) means
implicitly the this pointer is applied to the
function as
member_Function(Employee *const this, int a, int b).
Here the implicit this is a constant pointer to the
object's address of type Employee. Once the Object has been
created the address is given to it(e1). the address is
passed as the first argument becoz the function resolving
is faster...
| Is This Answer Correct ? | 12 Yes | 1 No |
difference between structure and union.
Why is abstraction needed?
• What are the desirable attributes for memory managment?
What is cohesion in oop?
Program to check whether a word is the first word of the sentence.
Why do pointers exist?
What are virtual functions?
what are abstract classes and how they impliment , with example
IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?
What is DeadlyDiamondDeathProblem ?
Hi All, I am new to programming and want to know how can i write a code to take input of 2 numbers from user and swap it without using a temp variable?
Can we have a private virtual method ?