GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Programming  >  PHP
Go To First  |  Previous Question  |  Next Question 
 PHP  |  Question 38 of 62    Print  
Is Inheritance supported in PHP?

  
Total Answers and Comments: 2 Last Update: September 07, 2007     Asked by: shilpak10 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 29, 2007 07:17:35   #1  
manohar        

RE: Is Inheritance supported in PHP?
Yes, Using extends keyword you can extend Superclass.
 
Is this answer useful? Yes | No
September 07, 2007 17:16:40   #2  
Ganesh        

RE: Is Inheritance supported in PHP?

Yes, Php supports Inheritance.

Lets go for an example,

Class Pay{
      var $Amt=10;
      var $M="";
      Function CheckAmt($Amt){
               $this->Amt=$Amt;
               }
}

Class Salary extends Pay{
      Function CheckAmt($Amt){
        $this->Amt=$Amt;
               If ($this->Amt > 1000){
                  echo "Good Salary";
               } else {
                  echo "Okay Salary";
               }
      }
}
$CheckP = new Pay;
echo $CheckP->Amt;
echo "<br>";
$CheckP->CheckAmt(1000);
echo $CheckP->Amt;
echo "<br>";
$CheckS = new Salary;
echo $CheckS->CheckAmt(100000);

HTH,
Ganes


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Yes, Php supports Inheritance.Lets go for an example,Class Pay{      var $Amt=10;      var $M="";      Function CheckAmt($Amt){               ...

Latest Answer : In PHP we can use only two Types of inheritance only those are single and multiple inheritances ...
Read Answers (3) | Asked by : Deep


 Sponsored Links

 
Related Articles

Microsoft AJAX Library - Inheritance using Prototypes

Inheritance using Prototypes Once again prototyping can help us implement an OOP feature in a more elegant way than when using closures Prototype based inheritance makes use of the behavior of JavaScript prototypes When accessing a member of a function that member will be looked for in the function
 

Microsoft AJAX Library - Inheritance using Closures

Inheritance using Closures and Prototypes There are two significant techniques for implementing the OOP concept of inheritance with JavaScript code The first technique uses closures and the other technique makes use of a feature of the language named prototyping Early implementations of the Microsof
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

C++ Inheritance

C Inheritance Introduction What is Inheritance Inheritance is the process by which new classes called derived classes are created from existing classes called base classes The derived classes have all the features of the base class and the programmer can choose to add new features specific to the ne
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school&rsquo;s al
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.&nbsp; By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.&nbsp; IT Certification offers several vari
 

Neuro-linguistic Programming Methods

Neuro linguistic Programming Methods There are several methods used for performing Neuro linguistic Programming on an individual for obtaining insights into the psyche of the person in order to correct to modify certain patterns of behavior These techniques are also used for Neuro linguistic trainin
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape