java - Which use for non-inherited abstract classes? -


what practice tells non-inherited abstract classes ?

is there reason them exist in program not aiming @ providing api ? make sense systematically turn such classes non-abstract classes? if in cases ?

well, abstract keyword forbids inctances creation (in order create instance 1 has inherit abstract class), however, abstract classes can have static methods e.g.

  // abstract: there's no sence in creating instance of class   abstract class mathlibrary {     // private: there's no sence in inheriting class     private mathlibrary() {}      // gamma function     public static double gamma(double value) { ... }     ...   } 

please note, when in java abstract final class not allowed, in c# abstract sealed class static class:

  // c# static == abstract sealed   public static class mathlibrary {     // gamma function      public static double gamma(double value) { ... }     ...   } 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -