Selenium/Java-OOPs-Encapsulation
We have started to learn OOPs concepts from last post, starting with Abstraction. In this post, we will go through the concept of Encapsulation. Encapsulation: Basically, Encapsulation binds data(variables) and code together. It is a process of wrapping up the data in single unit. We declare our variables as private, so it can not be accessed outside the class. Hence, it is also called data hiding approach. However, if you wish to access the variables outside the class, we can use public setter and getter methods to access such private variables. The first question arises here is, why to declare variables as private if anyway we can use it outside the class using setter and getter methods.. !! That's where the concept of Encapsulation flourishes..!! Here, we are declaring variables as private and hence one can not get the idea about the implementations of the class. User can only surmise that how the variable will be stored (It can be String, integer ...
Nice job buddy. I would like to hear more from you on such intrestiint topic
ReplyDeleteyes sure. you can learn with new posts every week. !!
Deletehello i have visited your blog first time.content was good enough but u have to put more real time scenario in actual where we have used oops concept in selenium
ReplyDelete..anyways nice job keep it up:)
Hi There, Thanks a lot. You will see more real time examples once we will start writing more complex scripts in Selenium. Here I am starting from beginners' level so flow can be maintained. Happy learning :)
DeleteGlad to connect !
ReplyDeleteThank you and same here ! Keep learning :)
Delete