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
Software
objects are often used to model the
real-world objects that you find in everyday life. Real-world objects share two
characteristics: They all have state and behavior.
A class is the blueprint from which the
individual objects are created. Class is composed of three things: a
name, attributes, and operations.
Hiding internal state and requiring
all interaction to be performed through an object’s methods is known as data
encapsulation — a fundamental principle of object-oriented programming
Polymorphism
means "one name, multiple forms". Using one name u can do multiple of
actions.
Example
of Compile Time Polymorphism : Method Overloading
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.
Abstraction
defines way to abstract or hide your data and members from outside world.
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.
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 is the process that allows a type or a
table to acquire the properties of another type or table.
The type or table that inherits the properties is called
the
subtype or
sub
table.
The type or table whose properties are inherited is called
the super type or super
table.
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.