OOPS have following features
1.
Object - Instance of class
2.
Class - Blue print of Object
3. Data Encapsulation - Protecting our data
4. Polymorphism - Different behaviors at diff. instances
5. Data Abstraction - Hidding our irrelavance
data
6. Inheritance - one property of object
is aquring to another
property of object
- Objects
- Class
- Data encapsulation
- Polymorphism
Example
of Compile Time Polymorphism : Method Overloading
Example of Run Time Polymorphism : Method Overriding
Example of Run Time Polymorphism : Method Overriding
Overriding is the concept of having functions of same name
and signature in different classes. one in the super class can be made virtual
and other can override the functionality of virtual one.
Overloading is the concept of having functions of same name, but different signature in same class. They are differentiated by the compiler by their signatures.
Overloading is the concept of having functions of same name, but different signature in same class. They are differentiated by the compiler by their signatures.
- Data Abstraction
Simply speaking Abstraction is hiding the complexities of your class or struct
or in a generic term Type from outer world. This is achieved by means of access
specifiers.
Interview Definition: - Hiding the complexities of your type from outside world.
Interview Definition: - Hiding the complexities of your type from outside world.
How to
Abstract: - By using Access Specifiers
.Net has
five access specifiers:-
Public --
Accessible outside the class through object reference.
Private --
Accessible inside the class only through member functions.
Protected --
Just like private but Accessible in derived classes also through member
functions.
Internal --
Visible inside the assembly. Accessible through objects.
Protected
Internal -- Visible inside the assembly through objects and in derived classes
outside the assembly through member functions.
- Inheritance
Inheritance allows for incremental modification so that a
type or table can inherit a general set of properties and add properties that
are specific to it.
You can use inheritance to make modifications only to the
extent that the modifications do not alter the inherited super types or super
tables.