Oops
Inheritance:-
It's a mechanism of consuming the members of one calls in another class by establishing parent/child relationship between the classes
Polymorphism:-
polymorphism is a mechanism of changing the behavior based on the inputs, that is the input changes automatically the output or behavior changes
Input changes
means:
Changes type of input parameter (int, string, list... etc)
Change number of input parameter
Change order of input parameter
Method Overloading:-
Method Overloading means it is an approach of defining multiple methods under the class with same name so we can define more then one method under the class with same name that is what we call method overloading
Method overloading is a approach of defining multiple behavior to a method, Method is same but behavior are different
Method Overriding:-
Method overriding is a approach of re-implementing a parent classes method under child class as exactly with the same definition
It's an approach of re-implementing a parent classes method under the child class with the same signature.
Difference between Overloading and Overriding:- Overloading:-
1. In this case we detain multiple methods with the same name by changing their parameters.
2. This can be performed either within the a class as well as between parent and child classes also.
3. while overlogging a parent class method under the child class, child class doesn't required to take permission from the parent class.
it doesn't required any modifier like virtual.
4. Overloading is all about defining multiple behaviors to a method.
Overriding :-
1. In this case we define multiple method with the same name and same parameter.
2. This can be performed only between parent child parent classes but never be performed with the in same class.
3. While overriding a parent's method under child class, child class required a permission from it's parent class.
- Permission means. if parent method use "Virtual" modifier then child class able to overriding otherwise not overriding.
Note:- if we want to overriding a parent's method under the child class first that method should be declared by using the Virtual modifier in the parent class.
4. Overriding is all about chaining the behavior of the parent method under child class.
Explain the difference between Task and Thread in .NET
Explain when to use Finalize vs Dispose?
how set came case json or xmal setting we dot net core
Comments
Post a Comment