Object Oriented Programming System
Object Oriented Programming System :
The main intention of object oriented concept is reusability
of existing code, providing security for data, decreasing the code complexity
i.e., basing on object requirement we coding and executing programs is main purpose of OOPS
Before OOPS there is Structure Oriented Programming
languages are used to develop programs, the limitations of structure oriented
programming languages are no reusability
concept and there is no security for
data . to retrieve the limitations OOPS concept is invited.
What are the limitations of Structure Oriented system ?
- Less security for data
- There is no reusability concepts
- There is more code complexity
- There is no exception handling
There are four main pillars of OOP System, they are :
- Data Abstraction
- Data Encapsulation
- Inheritance
- Polymorphism
These main concepts contains in
OOP system
Data Encapsulation :
The process of binding data into a
single container is known as data encapsulation.
Here data means methods and
variables and those are binding in a container, here we called CLASS
What is Class ?
Class is a collection of objects
which contains some common features and functionalities.
Class is a combination of member
methods and member variables.
Simply in one word class is blueprint for objects.
Ex ; animal is class for dog , cat
, goat
What is Objects ?
Object is an instance of class and
it is a real world entity which exists physically in world.
Ex : car is class and
Objects are BMW, Audi, Honda etc. there
is exists in market.
Without objects there is no class
like without students there is no Class like cse class, civil class.
SYNTAX for creating a Class:
<access-modifier> class <class-name>
{
Member methods ;
Member Variables ;
}
Ex :
public class MyClass // user defined class
{
string s="DotNet " ; // member variable
public void print() // member method
{
Console.WriteLine("Hello ,"+s);
}
}
SYNTAX for creating a Object :
<class-name> <object-name> = new
<class-name>(parameters);
ex :
class EntryClass
{
static void Main()
{
MyClass object = new MyClass(); // creating an object
object.s = "ramu"; // accessing methods variable through object
object.print(); // accessing member methods through object
Console.ReadKey();
}
Data Abstraction :
Hiding of data is known as Data Abstraction. i.e., Hiding the implementation and providing user required information only.
The nature of "instance" creation is also known as "Data Abstraction".
Access modifiers :
The permissions can be given to the object to access the class members from outside of the class using "access modifiers ".
So hiding of data is data abstraction for example in ATM machine it shows how to put card , how to withdraw money , how to check balance (which is need to people)only But It doesn't display how to collect money in machine, how to edit our balance in our account. that is it shows whatever information required (which is not required for user )only.
--------------------------------------------------------------------------------------------------------------------
tq
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletec net training in electronic city