Skip to content

Instantly share code, notes, and snippets.

@azonedev
Created October 17, 2022 04:15
Show Gist options
  • Save azonedev/654f5bb55e5296f94bd0dfaf153e3f72 to your computer and use it in GitHub Desktop.
Save azonedev/654f5bb55e5296f94bd0dfaf153e3f72 to your computer and use it in GitHub Desktop.
Traits :
Traits is kind of virtual path, in php we can't support multiple inheritance. So here comes the solution we can use multiple traits in a single class.
Interface :
Interface like a contact where we can declar properties & method And we can implement that on other class.
Abstract :
Sometimes we may come across a situation where we cannot provide implementation to all the methods in a class. We want to leave the implementation to a class that extends it.
An abstract class cannot be instantiated. It provides an interface for other classes to extend. Abstract method doesn’t have an implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment