Pergunta de entrevista da empresa IBM

What is the difference between an abstract class and an interface?

Respostas da entrevista

Sigiloso

8 de jun. de 2010

an abstract class can have a method body whereas an interface cannot

Sigiloso

3 de mai. de 2010

An abstract class is one whose main purpose is to define a common interface for its subclasses. An abstract class will defer some or all of its implementation to operations defined in subclasses; hence an abstract class cannot be instantiated Whereas an Interface you have to understand what do you mean by object type. An object's class defines how the object is implemented. The class defines the object's internal state and the implementation of its operations. In contrast, an object's type only refers to its interface—the set of requests to which it can respond