FEATURE OF OOPS in C#.Net
|
Ø Encapsulation
Ø Data
Abstraction
Ø Polymorphism
Ø Inheritance
|
Encapsulation definition
with example in C#.Net
Example:
using System; class BankAccountDetails { private string m_CustName; public string bankCustName { get { return m_CustName ; } set { m_CustName = value; } } } In this example. we are hiding the string bankCustName to the other object. |
What is Polymorphism?
|
|
Compile Time Polymorphism
|
||
Method Overloading
“Method with same
name but with different arguments
OR different sequence of
Parameter OR different
type of parameter is called method overloading”.
- Example of Method Overloading:
|
Run Time Polymorphism
|
|||||||||||||||||||||||||||||||||||||||
Method Overriding
“Method
with same name with SAME
arguments OR SAME sequence of parameter OR SAME type of parameter is
called Method
Overriding”.
- Method overriding forms Run-time polymorphism. - Example of Method Overriding:
|