Interface or multiple inheritence?
Well, I thought I could quickly put something about interfaces and their significance in java in particular and object oriented programming in general.
Let us take a look at the interface.
The above interface describes a contract that every class has to meet in order to be non-abstract. For example, say there are two different roles, one of student and other of teacher.
For above two roles, I would write two implementations. They are StudentRoleImpl and TeacherRoleImpl.
Both of the below statements are valid:
IRole l_role = new StudentRoleImpl();
IRole l_role = new TeacherRoleImpl();
To continue further...!
Let us take a look at the interface.
public interface IRole {
String getName();
String getDescription();
}
The above interface describes a contract that every class has to meet in order to be non-abstract. For example, say there are two different roles, one of student and other of teacher.
For above two roles, I would write two implementations. They are StudentRoleImpl and TeacherRoleImpl.
Both of the below statements are valid:
IRole l_role = new StudentRoleImpl();
IRole l_role = new TeacherRoleImpl();
To continue further...!