jibran3492 Posted February 24, 2014 Share Posted February 24, 2014 (edited) hi people,i want to know the difference between implementing abstract and extending an object(object inheritance) in php !according to what i know implementing abstract is using all code of parent class, and extending an object is also same including you can override a method...so if we have inheritance(i.e. extending an object) then why to use abstract ? Edited February 24, 2014 by jibran3492 Link to comment Share on other sites More sharing options...
Ingolme Posted February 24, 2014 Share Posted February 24, 2014 Abstract objects and inheritance aren't mutually exclusive. Inheritance is when a class extends from another one. An abstract class is just a class that doesn't represent any particular object you're going to create. An example of abstract class would be Vehicle. You extend Car and Bike from Vehicle, but you never create a new Vehicle. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now