Have you flustered in a recent technical interview or are you preparing for an up-coming interview? Many high-tech companies are screening candidates using textbook questions before bringing them in for further interviews. This article contains typical questions that interviewers will ask. Pay attention.
The two have significant differences, but also share many similarities. Hence, many people confuse and even interchange the two. This is not correct.
When one refers to polymorphism, one refers to the ability to interchange one definition with another possibly different definition, but which both share the same abstracted structure (interface). This allows for substitutability, which is the basis of inheritance and defines super and sub classes.
Hence, inheritance is a by-product of polymorphism. Inheritance is the ability of one class to be a subtype of some other super class.
Do not confuse the two, as inheritance only refers to subclasses having all of the abilities of its parent classes. While polymorphism means substitutability, which includes inheritance.
Overriding occurs when a subclass uses the same method signature and name as an ancestor's class method but provides an alternative definition.
Overloading, on the other hand, uses the same name for a method but a different signature. For example, having three parameters instead of two.
Classes are holders of implementations (unless you refer to abstract classes, also known as pure virtual classes). Whereas interfaces provides a public structure for users to interact and change the state of the object.
This is not a hard question, but you need to answer this correctly or your world will turn upside down like a stack, or was it the heap?
Both the heap and the stack represent memory locations in memory. Although implementations may vary, the stack usually grows downwards from the top of the allocated memory, while the heap is a group of addresses near the bottom (that typically grows upwards as necessary). This is used to maximize the available memory before a collision occurs.
The stack is often used for functionality such as function calls and returns. While the help is used to allocate additional memory during runtime that normally does not fit on the stack.
You should be able to ace the interview.
A big thank you for your post.Really looking forward to read more. Awesome.
Thanks so much for the article post.Really looking forward to read more. Cool.
Thanks-a-mundo for the blog post.Really looking forward to read more. Awesome.
I appreciate you sharing this article post.Really looking forward to read more. Really Great.
SMDIc4 Thanks-a-mundo for the article.Really looking forward to read more.