Statistics
The Highest Post







Statistics
Count 94
Avg 21.00
Min 21
Max 21
Angualr Top questions

Details



The Four Principles of Object-Oriented-Programming (OOP): Encapsulation<br><br> Encapsulation is accomplished when each object maintains a private state, inside a class. Other objects can not access this state directly, instead, they can only invoke a list of public functions. <br><br> Abstraction<br><br> Abstraction is an extension of encapsulation. It is the process of selecting data from a larger pool to show only the relevant details to the object. Suppose you want to create a dating application and you are asked to collect all the information about your users. You might receive the following data from your user: Full name, address, phone number, favorite food, favorite movie, hobbies, tax information, social security number, credit score. This amount of data is great however not all of it is required to create a dating profile. <br><br> Inheritance:<br><br> Inheritance is the ability of one object to acquire some/all properties of another object. For example, a child inherits the traits of his/her parents. <br><br> Polymorphism:<br><br> Polymorphism gives us a way to use a class exactly like its parent so there is no confusion with mixing types. This being said, each child sub-class keeps its own functions/methods as they are. If we had a superclass called Mammal that has a method called mammalSound(). The sub-classes of Mammals could be Dogs, whales, elephants, and horses. Each of these would have their own iteration of a mammal sound (dog-barks, whale-clicks).
Related Topics