Like Tree1Likes
  • 1 Post By Mario F.

Similarity between friend function and prototype

This is a discussion on Similarity between friend function and prototype within the Tech Board forums, part of the Community Boards category; Hello guys, This might be the wrong place to ask, but if anyone is familiar to JavaScript prototypes.. Is friend ...

  1. #1
    Registered User Geetika's Avatar
    Join Date
    Dec 2013
    Posts
    10

    Similarity between friend function and prototype

    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 ??

  2. #2
    Registered User Geetika's Avatar
    Join Date
    Dec 2013
    Posts
    10
    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.

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    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...

  4. #4
    Registered User Geetika's Avatar
    Join Date
    Dec 2013
    Posts
    10
    Quote Originally Posted by GReaper View Post
    Actually, no, this is the right place for you to ask about it, although a much better place would be a forum about javascript.
    well, i just don't know how to remove this post.. i would like to remove this post .. :\

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    2,706
    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.

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    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.
    stahta01 likes this.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function Prototype, Function Call, and Function definition
    By dmcarpenter in forum C Programming
    Replies: 9
    Last Post: 04-09-2013, 04:29 AM
  2. Replies: 4
    Last Post: 01-04-2013, 03:10 AM
  3. Function prototype in C
    By Darwin Chan in forum C Programming
    Replies: 4
    Last Post: 01-03-2013, 03:06 AM
  4. Replies: 13
    Last Post: 08-24-2006, 01:22 AM
  5. friend function and friend classes...usage question??
    By actionbasti in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2003, 10:53 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21