Basics Features of Object Oriented Programing Language. - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Basics Features of Object Oriented Programing Language. - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Saturday, June 17, 2017

Basics Features of Object Oriented Programing Language.


Basics Features of Object Oriented Programing Language.



Features of OOP : -
1.Class
2.Object
3.Inheritance
4.Polymorphism
5.Data Hiding And Encapsuation

Class : - Class is a group of object of same of same type .Once a class has declared we can create multiple numbers of their objects. E.g potato, onion, Cabbage are the object of class vegetables.

Example of Class in JAVA: -

Class Hello //Class hello
{

}



Object : - Objects are collection of entities .Object takes space in memory . Objects are instances of class. When program is executed the object the object interacts by sending message to another . Each object contain data and code to mainpulate the data.

Example of Class and Objects : -

Class Hello //Class hello
{
void run () //Member Function
{
System.out.print(“Hello World”);
}
}
class demo
{
public static void main (String args[])
{
Hello h=new Hello(); // Creating Object of class hello
h.run(); //Calling Method of class hello
}
}

Inheritance : - Inheritance is an Approach through in which object of one class can acquired the property of parents class. Inheritance is used for resuablity of codes.

Example of Inheritance
Class employee
{
int salary=1000;
}
//Extend is used to access the feature and property of parent class

Class developer extends employee
{
int bonus=500;
public static void main(String args[])
{
developer d=new developer();
System.out.println(“Salary is : ”+d.salary);
System.out.println(“Bonus is : ”+d.bonus);
}
}

Polymorphism : - the word polymorphism means many form any operation may exhibite different behaviour in different instance . The behaviour depend on what type of operation we used.
Example :- Function Overloading,Operator Overloading.

Example of Polymorphism

class adding
{
int add(int a,int b) //method one
{
return a+b;
}
// method two same name but differen parameter
int add(int a,int b,int c)
{
return a+b+c;
}
}
class demo
{
public static void main(String args[])
{
adding abc=new adding();
System.out.println(“Sum of 10 , 20 , 30 is : ”+abc.add(10,20,30));
System.out.println(“Sum of 10 , 20 is : ”+abc.add(10,20));
}
}

Data hiding and Encapsulation : - Since wrapping up of data member and menber in a single class is known as encapsulation. Through in which data as are not access by the outside world only member function can access the data this is data hiding. And Also when we hide the complexity of program are known as abstraction . And only essential feature can access. Like when we sending sms we dont what its internal processing we only give inputs.

Example of Encapsulation

class hello
{
int a;
void geta()
{
return a;
}
void seta(String n)
{
this.a=n;
}
}
//hiding the above class and then we only calling the method dont know about the internal processing.
class calling
{
public static void main(String args[])
{
hello h=new hello();
h.seta(“Charles”);
System.out.print(“Name is ”+h.geta());
}
}

14 comments:

  1. This blog is very useful information. Keep more sharing your information.Web Design Services Bangalore | Website Developers in Bangalore

    ReplyDelete
  2. Vendorzapp provides Mobile apps for small business, Ecommerce android apps development India, iOS ecommerce apps development, Ecommerce website Pune, Ready ecommerce website and apps. Android ecommerce apps then visit now Ecommerce android apps India, iOS ecommerce apps development, ecommerce website for small business call us +91-9850889625

    ReplyDelete
  3. Really nice blog... It is more informative...
    TechiewebSolutions provides the training and internship program for the freshers.
    It provide training for Web development, digital Marketing and IOS.

    ReplyDelete
  4. Really nice blog... It is more informative...
    TechiewebSolutions provides the training and internship program for the freshers.
    It provide training for Web development, digital Marketing and IOS.

    ReplyDelete
  5. Thank you very much for the informative article about Digital Agency. We won't tell you we are the best Web design Brisbane, But we assure to help businesses to generate more revenue through SEO Company Brisbane

    ReplyDelete
  6. Great list. I know many of them, but have now bookmarked several new ones. Thanks!I like This Blog Posting. I Will Recommend This Post to Our Friends.Web Design Sydney, Logo Design Sydney

    ReplyDelete
  7. Web Design Sydney: It is a great sharing...I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. .Logo Design Sydney,Logo Design in Coimbatore

    ReplyDelete
  8. Lovely blog with much more interesting article, I will keep on reading your update. Thanks for the share | Ear Plugs for Swimming | Ear plugs for Sleeping Custom Ear Plugs| Motorcycle Ear Plugs | Musicians Earplugs

    ReplyDelete
  9. Thank you for imparting such an informative content. I like the way you publish such an useful post which may help many needful. Professional Web design services are provided by W3BMINDS- Website designer in Lucknow.
    Web development Company | Web design company

    ReplyDelete

Post Top Ad