GoConqr has a new look! Let us know what you think.

Slides

Polymorphism

Eloy Marcos Domínguez Spanish 6 slides

Slides in this set (6)

  1. Polymorphism

    • In object oriented programming, polymorphism is a powerful and fundamental tool. It can be used to create a more organic flow in your application. This tutorial will describe the general concept of polymorphism, and how it can easily be deployed in PHP.
  2. What is Polymorphism?

    • Polymorphism is a long word for a very simple concept.
    • Polymorphism describes a pattern in object oriented programming in which classes have different functionality while sharing a common interface.
    • The beauty of polymorphism is that the code working with the different classes does not need to know which class it is using since they're all used the same way.
    • polymorphism is used to make applications more modular and extensible. Instead of messy conditional statements describing different courses of action, you create interchangeable objects that you select based on your needs.
  3. Interfaces and abstract classes

    • An integral part of polymorphism is the common interface. There are two ways to define an interface in PHP: interfaces and abstract classes. Both have their uses, and you can mix and match them as you see fit in your class hierarchy.
    • An interface is similar to a class except that it cannot contain code. An interface can define method names and arguments, but not the contents of the methods. Any classes implementing an interface must implement all methods defined by the interface. A class can implement multiple interfaces.
    • Interfaces and abstract classes
  4. abstract class

    • An abstract class is a mix between an interface and a class. It can define functionality as well as interface (in the form of abstract methods). Classes extending an abstract class must implement all of the abstract methods defined in the abstract class.
  5. Steps

    • Step 1: Identify The Problem
    • Step 2: Define Your Interface
    • Step 3: Create Your Implementation
    • Step 4: Use Your Implementation
    • Step 5: Put It All Together
    • Steps
  6. Conclusion

    • Polymorphism is an elegant way to escape from ugly conditional statements in your OOP code. It follows the principle of keeping your components separate, and is an integral part of many design patterns
    • Conclusion

Information

Description
oha
Created by
Eloy Marcos Domínguez · Aug 2017
Updated
Aug 17, 2017
Views
7
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?