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

Hiding library internal class to clients C++: use friend?

I'm trying to develop a networking part in my basic game engine in C++, but I'm faced with a rather strange problem (it is for me). I got a Singleton Networker class that handles the set-up of a socket (UDP) and will try to register the username…
RB-Develop
  • 196
  • 1
  • 9
0
votes
4 answers

friendship scope c++

In section 11.5.1 of "The C++ Programming Language", Bjarne Stroustrup writes: Like a member declaration, a friend declaration does not introduce a name into an enclosing scope. For example: class Matrix { friend class Xform; friend Matrix…
Trent
  • 2,328
  • 3
  • 33
  • 51
0
votes
2 answers

Friend functions and their relationship to the I/O Operators

I've pored over information regarding friend functions and their use. They're able to access encapsulated data within a class while not breaking one of the golden rules of OOP. In purveying various source code for overloading the I/O operators (A…
Taylor Bishop
  • 479
  • 2
  • 5
  • 18
0
votes
2 answers

Facebook FQL PHP - Get Friend's Friendlist?

In FQL/PHP, how to get the friendlist of a friend? I can not find in the Facebook Developer API Documentations also. I used something similar like this: SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 =…
夏期劇場
  • 17,821
  • 44
  • 135
  • 217
0
votes
1 answer

friend template definition. Include when and where?

I think I just need another set of eyes to find out what I'm doing wrong. This is the error: bfgs_template.hpp:478:5: error: ‘di’ was not declared in this scope bfgs_template.hpp:478:8: error: ‘b’ was not declared in this scope and this is a…
Wilmer E. Henao
  • 4,094
  • 2
  • 31
  • 39
0
votes
1 answer

C++ friend class with same name in different namespaces

I have two classes with the same name in different namespaces. I cannot modify the names of the classes. I want to add a method to one of the class, but I'm not allowed to add this as a public method. The other class is written in C++/CLI as ref…
user37337
  • 317
  • 2
  • 18
0
votes
2 answers

Define friend template method outside namespace

I have code with the following basic structure: namespace A{ template class CMyTable{ ... public: template friend std::ostream& operator<<(std::ostream&…
Haimo
  • 43
  • 5
0
votes
1 answer

Facebook api php select friend by id

I want to get the birthday date of a specific friend using facebook api php. I have the friend's id passed from a form with a friend list in te variable $_POST[friend_id]. I'm doing something like this but I can't get the friend data: $user =…
victor
  • 87
  • 2
  • 11
0
votes
1 answer

Facebook api php get specific friend profile

I want to know the date of birth of a specific friend. I'm using something like this. Is possible get this friend profile field? $user = $facebook->getUser(); $perms = array('scope' => 'email,user_photos,read_mailbox'); if ($user) { try { …
victor
  • 87
  • 2
  • 11
0
votes
1 answer

"invalid use of non-static data member" when accessing a templated class' field through befriended output operator

I get the following error when I try to access a templated class'es field through befriended output operator. Database.hpp: In function ‘std::ostream& ostream(std::ostream&, const Table&)’: Database.hpp:10:12: error: invalid use of non-static…
yauser
  • 707
  • 2
  • 8
  • 19
0
votes
2 answers

C++: friend function passing to non-friends

Doesn't this break encapsulation? B.h: class B{ int x, y; public: B() : x(1), y(1) {} B(const B& obj) : x(obj.x), y(obj.y) {} int getx(); int gety(); friend void pass_private_members(B&); }; B.cpp void…
naxchange
  • 893
  • 1
  • 11
  • 24
0
votes
2 answers

Friend Function, expected Primary Expression before . token

So there are two classes in separate header files Customer. h using namespace std; #include class Customer{ friend void Display(); private: int number, zipCode; public: Customer(int N, int Z){ number = N; zipCode =…
0
votes
1 answer

Sync Facebook user friends birthdays to my xcode application

Lot of confusion understanding when I googled and studied tutorials like Getting Started with the Facebook SDK for iOS ,Legacy iOS Tutorial etc.I have downloaded the FacebookSDK-3.0 as I use Xcode version of 4.2,added the sdk framework to my xcode…
Eshwar Chaitanya
  • 942
  • 2
  • 13
  • 34
0
votes
1 answer

Add a friend with iOS SDK

I'm working hard to find out a way to send a friendship request to a Facebook user using the iOS Facebook SDK (v.3.2). But it seems the SDK does not provide the API to do that. Anyone could tell me why Facebook decided this strategy with iOS and…
0
votes
2 answers

error when creating friend function, "coins does not name a type"

I'm just trying to create an overloaded friend function (Am I phrasing that right?) to add two different types of the class 'coins'. It seems I cannot get the syntax right. Can someone point me in the right direction? The logic implemented in my…
user2044504