Concept of Abstraction in PHP OOP – onlinecode

Concept of Abstraction in PHP OOP – onlinecode

In this post we will give you information about Concept of Abstraction in PHP OOP – onlinecode. Hear we will give you detail about Concept of Abstraction in PHP OOP – onlinecodeAnd how to use it also give you demo for it if it is necessary.

Concept of Abstraction in PHP

Concept of Abstraction in PHP is important php oop (object oriented programming) concept.

To show the needed/relevant information or details without showing all information which is not necessary is called abstraction.

Abstraction focus only what the object does instead of how.


Consider a very simple example in mathematics world – mulitplication. If we have two variables ‘x’ and ‘y’ then we simply say their multiplication without knowing what happening behind the scenes it means how variable value are stored in memory, how variable value convert in binary format, how processor processes the multiplication information.


Other example of Mobile Phone, mobile phones are common and as i know everyone are using mobile phone but they mostly know about their external feature like display screen and keypad buttons to dial a number, camera instead of what it does internally.

  1. abstract class MobilePhone
  2. {
  3. public Calling();// calling function
  4. public SendSMS();// calling function
  5. }
  6. public class Nokia1400 extends MobilePhone
  7. {
  8. // code here for Nokia 1400 class
  9. }
  10. public class Nokia2700 extends MobilePhone
  11. {
  12. public FMRadio();// calling function
  13. public MP3();// calling function
  14. public Camera();// calling function
  15. }
  16. public class BlackBerry extends MobilePhone
  17. {
  18. public FMRadio();// calling function
  19. public MP3();// calling function
  20. public Camera();// calling function
  21. public Recording();// calling function
  22. public ReadAndSendEmails();// calling function
  23. }
abstract class MobilePhone{public Calling(); // calling functionpublic SendSMS(); // calling function}public class Nokia1400 extends MobilePhone{// code here for Nokia 1400 class}public class Nokia2700 extends MobilePhone{public FMRadio(); // calling functionpublic MP3(); // calling functionpublic Camera(); // calling function}public class BlackBerry extends MobilePhone{public FMRadio(); // calling functionpublic MP3(); // calling functionpublic Camera(); // calling functionpublic Recording(); // calling functionpublic ReadAndSendEmails(); // calling function}

Label :

PHP

OOP

Object Oriented Programming

Program

Web Development

Hope this code and post will helped you for implement Concept of Abstraction in PHP OOP – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

6  +  1  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US