p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional JavaScript for Web Developers 3rd edition (http://p2p.wrox.com/forumdisplay.php?f=669)
-   -   problem with combination inheritance (http://p2p.wrox.com/showthread.php?t=95218)

leejim November 10th, 2015 10:23 PM

problem with combination inheritance
 
in chapter 6.3.3 combination inheritance sample.
in the code "SubType.prototype.constructor = Subtype"
why not "Subtype.protytype.constructor = SuperType"?

xioqua September 18th, 2016 12:22 AM

Quote:

Originally Posted by leejim (Post 302806)
in chapter 6.3.3 combination inheritance sample.
in the code "SubType.prototype.constructor = Subtype"
why not "Subtype.protytype.constructor = SuperType"?

you can see 6.3.1

the previous SubType.constructor is Function SubType; but now SubType is the instance of SuperType, "SuperType.constructor = SuperType" is just equal to "SubType.prototype.constructor = SuperType";

So if you do "SubType.protytype.constructor = SuperType", there will no change;

But, In my view, I think this“SubType.prototye = SubType” is not important, for
"SuperType.call(this, name);" is always work.


All times are GMT -4. The time now is 09:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.