Abstract Methods Classes

suggest change

Abstract Method

declared without an implementation

C++

pure virtual method

virtual void eat(void) = 0;

Java

abstract method

abstract void draw();

Abstract Class

cannot be instantiated

C++

cannot be instantiated; has at least 1 pure virtual method

class AB {public: virtual void f() = 0;};

Java

cannot be instantiated; can have non-abstract methods

abstract class GraphicObject {}

Interface

no instance fields

C++

nothing comparable to Java

Java

very similar to abstract class, but 1) supports multiple inheritance; 2) no instance fields

interface TestInterface {}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents