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.
- abstract class MobilePhone
- {
- public Calling();// calling function
- public SendSMS();// calling function
- }
- public class Nokia1400 extends MobilePhone
- {
- // code here for Nokia 1400 class
- }
- public class Nokia2700 extends MobilePhone
- {
- public FMRadio();// calling function
- public MP3();// calling function
- public Camera();// calling function
- }
- public class BlackBerry extends MobilePhone
- {
- public FMRadio();// calling function
- public MP3();// calling function
- public Camera();// calling function
- public Recording();// calling function
- public ReadAndSendEmails();// calling function
- }
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}
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