C# tutorial 001
Introduction to Object Oriented Programming
Technological world is dynamic . New tools and Technology coming day by day , and this
process is vast. Software Industry also come under the process , new tools and
technologies are coming to meet common people requirement, to make life easier to easier and
and removing the manual job with machine made work .The fast changing world made software
industry in a crisis . The most challenging work is to represent an entity which match with the
real life world , to improve quality of software and to design a software which can communicate
with other software technology and and communicate cross platform Technology . During design a
software engineer consider some following basic points
Object oriented programming like C + + , C # treat data as an element who is cannot
free flow to the program . Object oriented programming bind data functions together
which is called class . A data can be accessed by only the function associate with it .
No other object function class or system know the internal structure of the objects . This method
is called data binding . When we try to modify the data or access the data ,it can call only
by the functions . When two objects communicate between each other , without knowing the
internal structure of each other , they called only functions associate with the other object .
This is called data hiding . The following points are important to understand the concept of oops
objects : objects is an run time basic entity of an object oriented system . An object
content data and function associate with the data . An object can be anything to represent
a real life world . Car , student , football , computer anything . Example of an object.
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public Student(string name, int age)
{
Name = name;
Age = age;
}
//....other function and methods
}
functions : Function is an system define programming which can access data of an object .
It not only access the data , can communicate with other object also. Functions and heart of
OOPS concept . Function can have different accessibility modifier depending upon
the requirement . It can be private , public , protected , friend . Depending upon the requirement
to match of the real life world , software engineer define the accessibility modifier of a
function .
classes : We already discussed that an object contain data and the functions ,the interstate
of code which is the system we define is called class . Once a class is defined we
can create any number of instance of an class .Thus a class is a collection of objects of similar
types .
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public Student(string name, int age)
{
Name = name;
Age = age;
}
//....other function and methods
}
Inheritance : Inheritance is a property which can acquire the property of other class . A class
name x , another class name y , we can derive the property of x to y , bye inheritance .
We just need to tell the class who it is its parents class . Entire property of x will be drive to
y or automatically .
Polymorphism : Polymorphism means more than one forms . And operation can be exhibit
different behavior on different instance on different situation . For a simple example , if we call
a function parameter with a single string object , it will call the function which has only string
parameter . Maybe there function with different parameter with same name , function with
same signature will be called and execute .
There are two types of polymorphism static or compile time polymorphism and dynamic
or runtime polymorphism .In static static polymorphism the method which will be called
as decided during the compile time.Oveloding is the best example of static polymorphism .
This type of polymorphism compiler check the Parameter type number during compile time .
Runtime polymorphism which is called method overriding method overriding is a technique to
overide the base class to derived class.This type of polymorphism compiler does not know
the type and the parameter during compile time , at runtime it will be decided ,which method
will be called .If may match then execute or through error.It is called dynamic binding .
class Student
{
public class OverloadTest
{
public void Getdata(string a1, string a2)
{
Console.WriteLine("Adding Two String :" + (a1 + a2));
}
public void Getdata(int a1, int a2)
{
Console.WriteLine("Adding Two Integer :" +( a1 + a2));
}
}
static void Main(string[] args)
{
OverloadTest obj = new OverloadTest();
obj.Getdata("Hello ", "World");
obj.Getdata(5, 10);
Console.ReadLine();
}
}
Message passing : object oriented programming is object base , it is the heart of the
approach . Object to object communication is also necessary . Object can communicate with
other object by passing passing message as the real human does.
Benefit of object oriented programming as follows
process is vast. Software Industry also come under the process , new tools and
technologies are coming to meet common people requirement, to make life easier to easier and
and removing the manual job with machine made work .The fast changing world made software
industry in a crisis . The most challenging work is to represent an entity which match with the
real life world , to improve quality of software and to design a software which can communicate
with other software technology and and communicate cross platform Technology . During design a
software engineer consider some following basic points
- User friendliness
- Security and integrity
- Correctness
- Usability
Object oriented programming like C + + , C # treat data as an element who is cannot
free flow to the program . Object oriented programming bind data functions together
which is called class . A data can be accessed by only the function associate with it .
No other object function class or system know the internal structure of the objects . This method
is called data binding . When we try to modify the data or access the data ,it can call only
by the functions . When two objects communicate between each other , without knowing the
internal structure of each other , they called only functions associate with the other object .
This is called data hiding . The following points are important to understand the concept of oops
- Objects
- Function
- Classes
- Inheritance
- Polymorphism
- Dynamic binding
- Message passing
- Data abstraction and encapsulation
- Variable initialization
objects : objects is an run time basic entity of an object oriented system . An object
content data and function associate with the data . An object can be anything to represent
a real life world . Car , student , football , computer anything . Example of an object.
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public Student(string name, int age)
{
Name = name;
Age = age;
}
//....other function and methods
}
functions : Function is an system define programming which can access data of an object .
It not only access the data , can communicate with other object also. Functions and heart of
OOPS concept . Function can have different accessibility modifier depending upon
the requirement . It can be private , public , protected , friend . Depending upon the requirement
to match of the real life world , software engineer define the accessibility modifier of a
function .
classes : We already discussed that an object contain data and the functions ,the interstate
of code which is the system we define is called class . Once a class is defined we
can create any number of instance of an class .Thus a class is a collection of objects of similar
types .
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public Student(string name, int age)
{
Name = name;
Age = age;
}
//....other function and methods
}
Inheritance : Inheritance is a property which can acquire the property of other class . A class
name x , another class name y , we can derive the property of x to y , bye inheritance .
We just need to tell the class who it is its parents class . Entire property of x will be drive to
y or automatically .
Polymorphism : Polymorphism means more than one forms . And operation can be exhibit
different behavior on different instance on different situation . For a simple example , if we call
a function parameter with a single string object , it will call the function which has only string
parameter . Maybe there function with different parameter with same name , function with
same signature will be called and execute .
There are two types of polymorphism static or compile time polymorphism and dynamic
or runtime polymorphism .In static static polymorphism the method which will be called
as decided during the compile time.Oveloding is the best example of static polymorphism .
This type of polymorphism compiler check the Parameter type number during compile time .
Runtime polymorphism which is called method overriding method overriding is a technique to
overide the base class to derived class.This type of polymorphism compiler does not know
the type and the parameter during compile time , at runtime it will be decided ,which method
will be called .If may match then execute or through error.It is called dynamic binding .
class Student
{
public class OverloadTest
{
public void Getdata(string a1, string a2)
{
Console.WriteLine("Adding Two String :" + (a1 + a2));
}
public void Getdata(int a1, int a2)
{
Console.WriteLine("Adding Two Integer :" +( a1 + a2));
}
}
static void Main(string[] args)
{
OverloadTest obj = new OverloadTest();
obj.Getdata("Hello ", "World");
obj.Getdata(5, 10);
Console.ReadLine();
}
}
Message passing : object oriented programming is object base , it is the heart of the
approach . Object to object communication is also necessary . Object can communicate with
other object by passing passing message as the real human does.
Benefit of object oriented programming as follows
- Complexity software development can be easily handled .
- Future enhancement and development of father recruitment can be easily options .
- We can build a small software to a lot software gradually without affecting the user regular work .
- Data partition help us to keep data secure from other objects .
- Message passing can communicate between objects to object which meets the real life world activity .
- Redundant code of existing system can be eliminated.
- Real time system can be developed with large data.
No comments:
Post a Comment