OOPS concepts
Class & Objects
Specifiers
Abstraction
Encapsulation
Inheritance
Interfaces
Abstract Classes
Overloading
Overriding
Traits
When should i use static methods?
Final Keyword Static Keyword
- A class can have both static and non-static methods. A static method can be accessed from a method in the same class using the self keyword and double colon (::):
Encapsulation can be achieved by Declaring all the variables in the class as private and writing public methods in the class to set and get the values of variables.
Encapsulation solves the problem and issue that arise at the implementation stage.
Encapsulation enables you to hide the code and data into a single unit to secure the data from the outside world.
You can implement encapsulation using Access Modifiers (Public, Protected & Private.)
Abstraction solves the problem and issues that arise at the design stage.
Abstraction allows you to focus on what the object does instead of how it does it
abstraction can achieve using Interface and Abstract Class.
Abstraction shows only useful data by providing the most necessary details whereas Encapsulation wraps code and data for necessary information.