Hello guys,
This might be the wrong place to ask, but if anyone is familiar to JavaScript prototypes..
Is friend function in C++ the same as prototypes in JavaScript ??
Hello guys,
This might be the wrong place to ask, but if anyone is familiar to JavaScript prototypes..
Is friend function in C++ the same as prototypes in JavaScript ??
ADMIN: Kindly delete this post, as i haven't received any answers yet , moreover this is the wrong place to ask a question related to javascript.
Actually, no, this is the right place for you to ask about it, although a much better place would be a forum about javascript.
Devoted my life to programming...
Users cannot delete posts themselves - that power lies with the moderators. As far as I understand, posts are only deleted under exceptional circumstances. Your best bet would be to send a PM to a moderator with the request - though I don't know if it will be granted or not.
Prototypes only seem to follow one of the three properties of C++ friend classes.
C++ Friendship isn't commutative: If class A is a friend of class B, class B is not a friend of class A.
C++ Friendship isn't transitive: If class A is a friend of class B and class B is a friend of class C, class A is not a friend of class C.
C++ Friendship isn't inherited: A friend of class Base is not a friend of class Derived. if Base is a friend of class A, Derived is not a friend of Class A.
Of these, only the first property is emulated by prototypes. Prototypes are a means to implement member-like behavior in JavaScript objects and thus conform better to the notion of Inheritance than Encapsulation, which is what C++ friend classes are all about. So, no.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.