Skip to main content

Encapsulation



From the previous article I gave you a basic introduction about Object Oriented Programming. This article will gives you a clear picture on Encapsulation

Encapsulation is one of the four fundamental OOP concepts with inheritance, Polymorphism and Abstraction.It basically gives the  the idea of bundling data and methods that work on that data within one unit.It is used to hide the internal representation of a state of an object from outside.So when executing a  program it will make your code much safer.And this mechanism will be much more easier to use.

By using Encapsulation we can easily modify our code without breaking the code of others who use the same code.Also it enables the code to be,

  • flexible
  • maintainable
  • extensible

Example : 

class Person{
      private int age;
      private String name;
}

In here when using private key word it can only used inside the particular class. And this will not be visible to any other classes.

Hope to see you soon with another  Object Oriented Programming Concept




Comments

Popular posts from this blog

Object Oriented Programming Concepts

As a start for Object Oriented Programming at first we will be going through a basic introduction about Object Oriented Programming Concepts. OOP is a programming paradigm based on the concept of "objects", which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.  Brief History  The first object–oriented language was Simula (Simulation of real systems) that was developed in 1960 by researchers at the Norwegian Computing Center. In 1970, Alan Kay and his research group at Xerox PARK created a personal computer named Dynabook and the first pure object-oriented programming language (OOPL) - Smalltalk, for programming the Dynabook. In the 1980s, Grady Booch published a paper titled Object Oriented Design that mainly presented a design for the programming language, Ada. In the ensuing editions, he extended his ideas to a complete object–oriented design method. In the 1990s, Coad incorpora...

Scrum Methodology

What is Scrum Methodology? Scrum Methodology is an Agile methodology which is mainly focus on product development.But it is also can be used for software development processes.Its main aim is to avoid failure occurred in traditional development processes.It is an Iterative and incremental methodology. Scrum Scrum is mainly focused on fixed goals and last for period of 30 days.Key words related with Scrum methodology are, Product Backlog Sprint Backlog Sprint Product Backlog  List of all the things that is needed to do within the project.Basically a To do list that constantly re prioritized. Sprint Backlog A list of tasks identified by the  Scrum  team to be completed during the  Scrum sprint . During the  sprint  planning meeting, the team selects some number of  product backlog  items, usually in the form of user stories, and identifies the tasks necessary to complete each user story. In here highest prioritized tasks...