0
What does this two points means? Please someone help me to understand it in simple term..thank you^^
->Instance methods are not stored on a per-instance basis, even with virtual methods. They’re stored in a single memory location, and they only “know” which object they belong to because the this pointer is passed when you call them. ->They can be overridden since they are resolved using dynamic binding at run time.
3 Réponses
+ 3
1) Instance methods have a permanent storage in the heap memory but can be invoked only when an object of the class is created. It is possible because of the 'this' keyword which points to the current object and the methods can have different implementation based on the arguments passed to it which are stored on the stack.
2) Dynamic binding OR Dynamic method dispatch OR Runtime polymorphism are all the same thing in which the call by an overriding method to an overridden method is resolved at runtime and always the method of object type is only invoked.
3) Virtual methods are methods which can be overridden unlike static methods which cannot be overridden.
+ 2
Tushar you're welcome and good to know that it helped.
+ 1
Avinesh Omg you so good at simplifying anythings...!! Tnx a lot