GofPatterns Gofpatterns  

Design Patterns  «Prev  Next»

Three types of design Patterns

Polymorphism allows instances of different classes to be used as an instance of a common superclass . For example, an EncryptionStream object might only have a reference to an abstract Cipher object.
The type of encryption the EncryptionStream performed could be adjusted by changing from a DESCipher to an RSACipher.
In cryptology, RSA is an algorithm for public-key cryptography. It was the first algorithm known to be suitable for signing as well as encryption, and one of the first great advances in public key cryptography. RSA is widely used in electronic commerce protocols, and is believed to be secure given sufficiently long keys and the use of up-to-date implementations.

Real World Example of Polymorphism:

Example 1: A Teacher interacts with student. A Teacher interacts with his or her seniors.
Here teacher is an object but the attitude is different based on the situation.
Example 2: Person interacts with genetic offspring in house at the same time that person interacts with an empoloyee in the office.
Example 3: Your mobile phone, has one name of many forms:
  1. As phone
  2. As camera
  3. As mp3 player
  4. As radio