Questions tagged [friend]

In object-oriented programming, friend refers to a method or class that has access to some non-public aspects of a particular class.

In object-oriented programming, friend refers to a method or class that has access to some non-public aspects of a particular class.

Different programming languages use the friend keyword differently. Make sure it is clear which language you are asking about.

1518 questions
0
votes
2 answers

what does undefined reference to operator<<.... means? in c++

I have friend function in the class. (in header file. head.h) i have implemented in head.cpp and in head.h outside of the class i have ostream& operator<< (ostream& out, TreeNode* ptr); i implemented in head.cpp as well. Is there any problem with…
fhuseynli
  • 630
  • 3
  • 12
  • 26
0
votes
2 answers

assignment of an protected struct member to a friend?

I have a classes that contains data in form of MyObjects like class A. I wish to Monitor the data in the MyObject objects. So I created a IMonitorable class and derived all my storage classes that contains the MyObjects from IMonitorable. Add added…
Steve
  • 1,072
  • 11
  • 28
0
votes
4 answers

friend function of a templated class needs access to member type

I need to define a friend function for the templated class. The function has return type that is a member type of the class. Now, I can not declare it beforehand, since the the return type is not known at the time. Something like…
user1672572
  • 321
  • 2
  • 9
0
votes
3 answers

friend declaration block an external function access to the private section of a class

I'm trying to force function caller from a specific class. For example this code bellow demonstrate my problem. I want to make 'use' function would be called only from class A. I'm using a global namespace all over the project. a.h #include…
MiP
  • 5
  • 3
0
votes
2 answers

scope of friend function

I have two classes, one and two, each having a friend member function with an pointer to the other. The first header file is as per below: #ifndef FIRSTCLASS_H #define FIRSTCLASS_H class two; class one { private: int one_data; public: friend…
maths-help-seeker
  • 946
  • 1
  • 10
  • 30
0
votes
1 answer

ruby on rails friendship following shows always my name

friendship.rb belongs_to :user, :include => [:profile] belongs_to :friend, :class_name => 'user' user.rb #following code has_many :friendships has_many :friends, :through => :friendships #followers code has_many :inverse_friendships,…
stergosz
  • 5,754
  • 13
  • 62
  • 133
0
votes
1 answer

Pointing a friend invitation to a page tab application?

I've made a facebook application and added it to a fan page. I've also added some code to send friend requests and it redirects fine after the dialog. However, the notifications received by friends are pointing to a URL of this…
James P.
  • 19,313
  • 27
  • 97
  • 155
0
votes
2 answers

Sharing a field method with class

I have a class with objects Now i want to call a function from Box and Toy object from outside of the Container class class Container { Box box1 = new Box(); Toy toy1 = new Toy(); public void open() { box1.open(); } public…
John Frost
  • 673
  • 1
  • 10
  • 24
0
votes
1 answer

Magento "Tell a Friend " redirects to 404 page inside tab

I have showed "Tell a Friend " form in tabs on product detail page using the code below
Ayesha A
  • 1
  • 1
0
votes
1 answer

ios ShareKit 2.0 method for getting user friends list from facebook?

Is there a method in ShareKit 2.0 ios sdk that returns the loged in user (facebook) friends? Thanks
user1078065
  • 412
  • 1
  • 5
  • 19
0
votes
2 answers

Can't define method of a class as a friend of another class

I'm trying to make MainScheduler's method addJob a friend function of the class Job, as so: #include "MainScheduler.h" //forward declaration class MainScheduler; class Job: { friend void MainScheduler::addJob( Job* const job ); ... } But I…
Idan
  • 5,365
  • 5
  • 24
  • 28
0
votes
1 answer

friendship getting inherited ?? strange

As it is said - "friends are not inherited" . it means that class c {public: friend void i_am_friend(); }; class d:public c {public: // }; here void i_am_friend() is not inherited in class d .In more technical terms(i think this way.) Object…
T.J.
  • 1,466
  • 3
  • 19
  • 35
0
votes
3 answers

friend function issues

I'm having some difficulties with friend functions in C++, but my suspicion is that is more of a symptom of a problem I have with preprocessor directives and #include. This is a silly example of what I was doing. Five files: bobby.h, bobby.cpp,…
Tim
  • 301
  • 1
  • 5
  • 8
0
votes
1 answer

Initialize a friend array in main form, VB

I am working on a VB Windows Form and I have a question here about initialize an array (friend variable) I have a BookInfo class as following: Public Class BookInfoForm Friend _books() As BookInfo ... EndClass And in my main form, I want to…
Allan Jiang
  • 11,063
  • 27
  • 104
  • 165
0
votes
1 answer

Why does my query result repeat 3 times?

the code i have below basically behaves as a friend search engine where you can add someone if you don't have them on you account. So i am trying to do the following: If exists it should just display the friend and if not then it should say add…
ariel
  • 2,962
  • 7
  • 27
  • 31