java - Why do we need constructors and private members in the abstract class? -


Why do we need constructors and private members in intangible classes? It is not that we are ever going to make an example of that class.

To create an example , examples of the derived class. Those derivative classes will still need to call the Consultants, and can still call intangible members - who can use private members.

Here is an example (one is not very useful, but the basic idea to just show it ...)

  public intangible class named object {personal last string name = Name; Secure Named Object (string name) {this.name = name; } Public string getName () {return name; }} Public Class Computer NamedObject {Private Final Pro Processor Speed; Public computer (string name, int processor speed) {super (name); See //, the manufacturer is useful. Processor = Processor Speed; } Public string toasting () {getName () + "(" + + Processor Speed ​​+ ")"; }}  

I can not say that I often write intangible classes that often, generally like the structure of heritage, but when I Make they definitely use constructor and private members.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -