How to present abstract class which has relationship with interface class in class diagram

Tags: , , , ,

I have to do diagram with minimum of one abstract class and interface.I though to be a good idea to implement the interface class here. My table is customer which is the abstract class.The interface class shows the methods that needs to be included in the two types of customers.My question is,is this how I present an abstract class which is connected with interface class. Should I leave the customer class blank? Is it wrong to use interface with abstract class ?

This is my diagram:

enter image description here


interface is not a class. Given below is a definition from Oracle’s tutorial:

In the Java programming language, an interface is a reference type,
similar to a class, that can contain only constants, method
signatures, default methods, static methods, and nested types. Method
bodies exist only for default methods and static methods. Interfaces
cannot be instantiated—they can only be implemented by classes or
extended by other interfaces.

The same page mentions,

There are a number of situations in software engineering when it is
important for disparate groups of programmers to agree to a “contract”
that spells out how their software interacts. Each group should be
able to write their code without any knowledge of how the other
group’s code is written. Generally speaking, interfaces are such

Thus, in the interface, you should put the method signatures (contracts) which you want all implementing classes should mandatorily have.

Your abstract class can implement some of these methods and these implementations serve as the default implementation for the child classes (i.e. the classes which extend the abstract class). This class can have additional members for its child classes to be inherited.

Source: stackoverflow