Remember to call the SUPER class construction method!

xiaoxiao2021-03-06  46

Today, I saw the source code of Tomcat's AJP13, found a very worthless place, whether or not to inherit a certain type, call the super () method in the constructor. I have seen some code about Tomcat, but I did not find this phenomenon before. I don't know what it is today, I suddenly discovered it.

********************* Public AJP13 () {super (); initbuf (); reqhandler = new requestHandler (); reqhandler.init (this);}

Public Ajp13 (RequestHandler Reqhandler) {super (); initbuf (); this.reqhandler = reqhandler; reqhandler.init (this);} ******************************** This should be a program habit, from this small place, you can also see people who engage in Tomcat have good programming habits. After all, I can notice that every place is not so easy. Learn from experts!

转载请注明原文地址:https://www.9cbs.com/read-40764.html

New Post(0)