Question:What are the abstract class and interface?

 

Answer Abstract class:  An abstract class is a class that really isn’t supposed to ever be instantiated but instead serve as a base class to be inherited by other classes. Syntax->
         abstract class Class_name{
             //insert attribute definitions here.
             //insert method definitions here.
         }   
Interface: An interface defines a general specification for implementing a particular service,   
               declaring the required functions and constants without specifying exactly how it must be      
               implemented. In PHP, an interface is created like so :
         Interface  InterfaceName{
CONS 1;
………..
CONS N;
function methodName1();
……………………………………..
function methodNameN();  
       }  


Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in D:\webserver\www\vcampusbd.com\answers\column_answer_two.php on line 128
+ Report
Total Preview: 895
What are the abstract class and interface?

Copyright © 2024. Powered by Intellect Software Ltd