friend

VB.NET: what does the 'friend' modifier do?

What does the 'friend' modifier do in VB.NET? Why is it the default modifier for GUI components in Visual Studio? ...

Set a project default for VB.NET projects so that the default Modifiers property for controls is Private

Is it possible to set a project default for VB.NET winforms projects so that the default Modifier for controls added to winforms is Private (not Friend)? I know there's a "modifiers" property in the properties window so I can set it for each individual control... however I would like to change the project so from now on myself and other...

How to befriend a templated class's constructor?

Why does class A; template<typename T> class B { private: A* a; public: B(); }; class A : public B<int> { private: friend B<int>::B<int>(); int x; }; template<typename T> B<T>::B() { a = new A; a->x = 5; } int main() { return 0; } result in ../src/main.cpp:15: error: invalid use of constructor ...

C++ Beginner - 'friend' functions and << operator overloading: What is the proper way to overload an operator for a class?

Hello, everyone! In a project I'm working on, I have a Score class, defined below in score.h. I am trying to overload it so, when a << operation is performed on it, _points + " " + _name is returned. Here's what I tried to do: ostream & Score::operator<< (ostream & os, Score right) { os << right.getPoints() << " " << right.scoreGetN...

getting list of people who follows you on friendfeed with ff-api

is there any way to getting list of people who follows you on friendfeed with ff-api? ...

C++ friend class std::vector

hello. Is it possible to do the following portably: struct structure { structure() {} private: // only allow container copy construct structure(const structure&) {} // in general, does not work because allocator (not vector) calls copy construct friend class std::vector<structure>; }; example message trying to com...

Is there a simple way to emulate friendship in php 5.3

I need some classes to befriend other classes in my system. Lack of this feature made me publicize some methods which shouldn't be public. The consequences of that are that members of my team implement code in a bad and ugly way which causes a mess. Is there a way to define a friendship in php 5.3? (I am aware of http://bugs.php.net/...

Friends, templates, overloading <<

I'm trying to use friend functions to overload << and templates to get familiar with templates. I do not know what these compile errors are: Point.cpp:11: error: shadows template parm 'class T' Point.cpp:12: error: declaration of 'const Point<T>& T' for this file #include "Point.h" template <class T> Point<T>::Point() : xCoordinat...

Member is inaccessible from friend class

I have a declaration like this #include "Output/PtPathWriter.h" // class PtPathWriter // I've also tried forward declaring the friend class // leg data is a class designed to hold data for a single leg. class PtPathLeg { friend class PtPathWriter; // doesn't work //friend void PTPathWriter::writeToFile(string fileName, PtPath* ...

Friends, templates, overloading << linker errors

I had some good insight to an earlier post regarding this, but I have no idea what these compile errors mean that I could use some assistant on. Templates, friends, and overloading are all new, so 3 in 1 is giving me some problems... 1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall Point<double>::Point<double>...

I'm trying to use a PHP code for panel visibility in a Panels3 based on Friendlist

I'm trying to gain a truth value to gain panel visibility. I have a view in place in a panel to display a listing of heartbeat messages that belong to a user. The display works but I cannot figure out how to restrict access to the panel based on the user who is viewing the panel. Goal is I want the panel to only be visible to friends and...

How to define and use a friend function to a temlate class with the same template?

I have written the following code: #include <iostream> using namespace std; template <class T> class AA { T a; public: AA() { a = 7; } friend void print(const AA<T> & z); }; template <class T> void print(const AA<T> & z) { cout<<"Print: "<<z.a<<endl; } void main() { AA<int> a; print<int>(a); } And getting the following ...

VB.NET Visual Inheritance: Friend VS Protected

Why is it that some components/controls will not be inherited visually in a child form if they are declared with the access modifier Friend vs when they are declared with Protected. For example, I've got a DataSet object in my Parent Form that was initially "Friend" (I drag and dropped it to the form, so it was shown as a control in th...

In C++, does adding a friend to a class change its memory layout ?

Also, does it matter where in the class you declare the friend ? Does it matter if you add a friend class or a friend function ? ...

F# Friend function/class

Is it possible to implement friend function and friend class (as in c++) in F#? Update: Since there is no friend function/class in f#, and friend is not even a reserved keyword for future expansion, I'm wondering is there any problems with the friend mechanism in F# that make the developers to decide not to implement it? (such as in "p...

Linking "Friends" with the account holders profile

I am designing an application where an account holder has "friends". How would I go about linking those friends to the original account holder? Would an efficient SQL table be something like: AccountHolderID (varChar 20) FriendsID (nText) ...

clean C++ granular friend equivalent? (Answer: Attorney-Client Idiom)

Why does C++ have public members that anyone can call and friend declarations that expose all private members to given foreign classes or methods but offer no syntax to expose particular members to given callers? I want to express interfaces with some routines to be invoked only by known callers without having to give those callers comp...

Is this key-oriented access-protection pattern a known idiom?

Matthieu M. brought up a pattern for access-protection in this answer that i'd seen before, but never conciously considered a pattern: class SomeKey { friend class Foo; SomeKey() {} // possibly make it non-copyable too }; class Bar { public: void protectedMethod(SomeKey); }; Here only a friend of the key class has a...

Unused friend class in C++

Is there a way to detect (for instance with compiler warning) if classes are declared friend but do not access private members, ie. when friendship is useless? ...

friend with class but can't access private members

Friend functions should be able to access a class private members right? So what have I done wrong here? I've included my .h file with the operator<< I intent to befriend with the class. #include <iostream> using namespace std; class fun { private: int a; int b; int c; public: fun(int a, int b); void my_swap(); ...