Therefore, having this On button to boil the water is known as Abstraction. Instead, I have to fulfill my work easily. I don’t want to know the inner workflow of the kettle where it has high resistance and that resistance produces heat and boils the water. I just turned on the On button to start boil water. Today morning I wanted to make a hot tea and I used a water kettle to boil the water. AbstractionĮxposing necessary features of a class without explaining much or details is done by Abstraction. So, the hidden parts of a class acts like Encapsulation & the exposed parts acts like Abstraction. This controlling of accessibility is also known as Information hiding.Įncapsulation allows to expose the necessary things and hiding the important things from the outside world. Programmers can define and specify the accessibility of the member variables while under development rather than making all the variables global like in procedural languages. This can be defined at the implementation stage. The function defined in the class only can access the properties. You - external application or another software codeīy using Encapsulation, data can be restricted from the usage of the outside world. Pharmacist - act as member function/method where he/she helps in giving you the medicine Medicines - act as variables or properties or attributes You handover the prescription to the pharmacist and then he/she will take the medicine from the store & give you the bill. You are going to the pharmacy to buy prescribed medicines for you. Class is a best example for Encapsulation. Similarly, all the data members (variables,attributes/properties) & behaviors(functions/methods) are gathered together and closed. To see what's inside we need to open up that cover. We can't find anything with our naked eye. ![]() Have you ever used a tablet/medicine which encapsulated by a colored cover? Medicines are encapsulated & placed inside the tablet Syntax for Creating an object of Mango from class Tree: We can store and retrieve all the properties & behaviors we defined for the class Tree by creating an object of Mango. Absorbing water from roots to the upper parts.That is, State/properties/attributes all represents the same thing. State/properties are used to define the attributes of an object. ![]() Once the Class has been created we can create as many Objects as we want.įor example, take a class named Tree. Simply said, Class is a user-defined data type. ![]() These can be portrayed as objects in OOP.Ī Class is a blueprint or prototype that defines variables/properties and methods/functions common to all objects of a certain kind. In our day-today life we see a lot of objects like a television, mobile phone, dog, humans, cars & other living and non-living objects. These concepts simplify & add more value to Object Oriented Programming.īefore moving into these concepts, we need to know about Class & Objects.Īn Object is the basic run-time entity in OOP. To program in Object Oriented Programming, concepts called “ Object Oriented Concepts” are used. Python - Python is both a Scripted/Structured & Object Oriented Language.They are mostly high level languages such as The languages that use Object Oriented Programming paradigms are known as Object Oriented Programming Languages. Manipulating objects and getting the results is the ultimate goal of Object Oriented Programming. “Object Oriented” - the Object plays an important role. Object Oriented Programming is one of the most widely used programming paradigms.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |