TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Object Oriented Concepts - Part I
Gomathi Palaniswamy
Jul 03, 2012
7.6
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Lets learn the concept of Object Oriented Programming Language.
What is OOPs?
OOPs is stands for Object Oriented Programming. It is a design philosophy. Programming language consist of data fields and methods. We use methods and data fields for developing applications. OOPs define some guidelines to design applications and programs.
What is Object?
In real life everything is an object. For instance, chair is an object, table is an object. The object may be living object or non living. Each and every object has peculiar behavior and attributes. If you take human as example his character is attribute and his activities are behaviors. As like real time our programming language objects also having some attributes and behavior. In program object elements are attributes and methods are behavior.
What is Class?
Blue print of object is called as class.
Object and Class Relationship:
For instance “marriage” is an application. Before marriage we print invitation. The invitation is a class.
How the invitation is a class?
What the invitation consist? The invitation consist the matter of what is the function? Where is the function? When is the function? The details of groom and bride groom etc. Same as marriage the class consists the code of data members and functions. So we can tell the invitation and classes are blue print.
How to relate object in marriage?
How the marriage will happen. The marriage will be over by changing rings between boy and girl. So actual binding taken place by changing ring. Here the ring is like object. The class will be called when the object instantiated.
Coding Example:
class
Program
{
void
method()
{
Console
.WriteLine(
"Class"
);
}
static
void
Main(
string
[] args)
{
Program
obj =
new
Program
();
obj.method();
Console
.ReadLine();
}
}
Why OOPs?
In application some data's will be used throughout the application. That time the data have to be travel and should be protected. To protect the data member information we can go for oops concepts.
In some other cases we use functions in different pages. That time we need to write same function in multiple pages .Because of rewriting the time and space will be wasted. You can solve this problem by using oops. By oops you can use existing function for every time instead of writing new function.
The OOPs allows us to use same function for different purpose.
How OOPs?
Protected data transfer can be achieved by encapsulation
Reuse of function is achieved by inheritance
Multiple form of single function is achieved by Polymorphism
Advantages of OOPs:
Object-Oriented Programming has the following advantages
Existing code can be changed easily at run time
The OOPs use interface between classes to avoid dependency
Create clear modular structure
Basic OOPs Concepts:
Encapsulation
Inheritance
Polymorphism
The basic concepts will be discussed in with real time example next chapter.
Object Oriented Concepts - Part I
Next Recommended Reading
C# Programming Performance Tips - Part One - String Split