Skip to main content
reverting
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19

No, They are not obsolete.

Interface can't really substitute abstract class but comparing Abstract Method with Interface will be fair as both can constitute polymorphism.

In fact, there is an obscure but fundamental difference between Abstract MethodsClasses/Methods and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes/methods.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

Interface can't really substitute abstract class but comparing Abstract Method with Interface will be fair as both can constitute polymorphism.

In fact, there is an obscure but fundamental difference between Abstract Methods and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes/methods.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

In fact, there is an obscure but fundamental difference between Abstract Classes/Methods and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes/methods.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

added clss/method difference
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19

No, They are not obsolete.

Interface can't really substitute abstract class but comparing Abstract Method with Interface will be fair as both can constitute polymorphism.

In fact, there is an obscure but fundamental difference between Abstract ClassesMethods and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes/methods.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

In fact, there is an obscure but fundamental difference between Abstract Classes and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

Interface can't really substitute abstract class but comparing Abstract Method with Interface will be fair as both can constitute polymorphism.

In fact, there is an obscure but fundamental difference between Abstract Methods and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes/methods.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

added 14 characters in body
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19

No, They are not obsolete.

In fact, there is an obscure but fundamental difference between Abstract Classes and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classesrelated classes, i mean), then go for Abstract classes.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classesUnrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

In fact, there is an obscure but fundamental difference between Abstract Classes and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

No, They are not obsolete.

In fact, there is an obscure but fundamental difference between Abstract Classes and Interfaces.

if the set of classes in which one of these has to be used have a common behaviour that they share (related classes, i mean), then go for Abstract classes.

Example: clerk, Officer, Director -all these classes have CalculateSalary() in common, use abstract base classes.CalculateSalary() canbe differently implemented but there are certain other things like GetAttendance() for example which has a common definition in base class.

If your classes have nothing common(Unrelated classes, in the context chosen) in between them but has an action that is greatly different in implementation, then go for Interface.

Example: cow, bench, car, telesope-not related classes but Isortable can be there to sort them in an array.

This difference is usually ignored when approached from a polymorphic perspective. But I personally feel that there are situations where one is an apt than the other for the reason explained above.

added 14 characters in body
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19
Loading
refinement
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19
Loading
Source Link
WinW
  • 1k
  • 1
  • 8
  • 19
Loading