difference between inheritance and interface?

S

syntax

what is the difference between one level inheritance and one level
implementation of interface ?

i.e



what is the difference between the following :


class myclass extends abc
{
....
}

AND

class myclass implements interface_name
{
....
}
 
R

Ryan Stewart

syntax said:
what is the difference between one level inheritance and one level
implementation of interface ?

i.e



what is the difference between the following :


class myclass extends abc
{
...
}

AND

class myclass implements interface_name
{
...
}

For an extensive discussion of class vs interface, see "abstract class
versus interface" and "Design - inheritance vs interface" threads in
comp.lang.java.programmer.
 
C

Collin VanDyck

By implementing an interface, your object guarantees that the methods laid
out in the interface will be implemented.

By extending a base class (inheritance), you inherit from the base class
public and protected instance methods and members. In other words, those
methods and members are accessible from your new object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top