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
1 answer

How to retrive friends email id from connections

How to retrive friends email id from connections. using API.We are using auth for the development purpose. With Regards Gurudath
Gurudath BN
  • 1,391
  • 20
  • 21
0
votes
2 answers

How to overcome lack of friendship in C#?

I quite like the friendship feature of C++. Say, we have a Parent and Child. Child's ctor takes a Parent as a parameter: Child::Child(Parent & parent) { // Parent::RegisterChild is private parent.RegisterChild(this); } Due to friendship,…
Spook
  • 25,318
  • 18
  • 90
  • 167
0
votes
1 answer

How does a friend assembly restrict the access level?

When declaring an assembly as friend with [assembly: InternalsVisibleTo("MyFriend")], I have to use the name MyFriend for the other assembly to get access to the internal classes/methodes. Now I am confused. How is this an lower access than…
John Threepwood
  • 15,593
  • 27
  • 93
  • 149
0
votes
0 answers

C++: Possibility of inline function, friend to multiple classes?

I am working on implementing an intersection test between a sphere and a triangle. I want to design a function to do this. The function sphere_triangle_intersection_test( ... ) should be declared as a friend function to both class sphere and class…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
0
votes
1 answer

Adding friend with verification message to inbox

I have this code which is stored on a view_profile.php page. It has a form called Add as a friend. There are no syntax errors. But when I submit the form nothing happens when it should refresh and send me to the outbox page? Also, it should send a…
user2321471
0
votes
1 answer

Access private member of nested friend class in specialized template

The following code fails to compile in Visual studio 2103 Express preview: template class TTOuter; template<> class TTOuter<1> { public: class inner { friend class TTOuter<1>; private: inner(int n) : data(n) {;} …
skm
  • 329
  • 2
  • 9
0
votes
2 answers

How to provide protection to friend function in C++

I have just started learning friend functions in C++.This is the program which I am using for the concept exploration. #include using namespace std; class one { private: int age; public: one() { age=1; } void…
Naveen
  • 7,944
  • 12
  • 78
  • 165
0
votes
2 answers

How do I create friends?

I can't seem to get Amistad friendships to work correctly. I am getting the following error: ActiveRecord::RecordNotFound in FriendshipsController#update Couldn't find Friendship with id=29 I am also using devise and cancan. I followed the gem…
Thomas
  • 2,426
  • 3
  • 23
  • 38
0
votes
1 answer

How to get the name of a Facebook friend?

I'm just playing around with the Facebook API in C# (Windows Form App), and I'm struggling to figure out how to get the name of a selected friend. I already have the uid for that friend using the following code: IList myFreinds =…
Jason Underhill
  • 765
  • 1
  • 10
  • 18
0
votes
1 answer

Function operator= must be a member function

I have a function prototype inside a public class access specifier. This is the prototype: friend void operator=(String &s,char *str); The String is the class where it's prototyped. As you can see it's a friend function. By keeping it this way it…
Robert Lucian Chiriac
  • 686
  • 2
  • 15
  • 24
0
votes
1 answer

I don't know what is wrong. Check if 2 users are friends in laravel

i'm new in working with mvc frameworks. I am currently learning Laravel and i'm stuck. I need to make my model check if two users are friends. I have the following database: CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL…
lopiar
  • 27
  • 6
0
votes
2 answers

Relational operators on a class template

This will not work template struct foo { T t; }; bool operator==(const foo &lhs, const foo &rhs) { //error, requires template arg return lhs.t == rhs.t; } Is this the correct way to solve this? I want define also the operators…
7cows
  • 4,974
  • 6
  • 25
  • 30
0
votes
1 answer

Unable to call constructor of friend class

I am trying to call my SocketConnection constructor from inside the definition of the node class, but I'm failing to understand the compile error I'm getting - I fail to see why the compiler thinks the constructor I declared for SocketConnection is…
0
votes
1 answer

C++: hide class construction from user

I am developing a series of event classes. These classes contain information acquired from a system. They are from different natures and may contain different messages, for example: one possible event will contain a huge list of number, while…
Fred
  • 417
  • 6
  • 14
0
votes
1 answer

Accessing private variable from a friend class - I believe my syntax is wrong

Okay, so this is a parking ticket application... I'm sure you've all seen/done them before. This one is for C++ and I'm having trouble with getting my class-contained methods to access private members of a friend class. I know that this is…
Heather T
  • 323
  • 1
  • 10
  • 20