friendship

When is it prudent to use friendship in OOP?

I'm currently getting through the http://www.cplusplus.com tutorial and I came across this section here: http://www.cplusplus.com/doc/tutorial/inheritance.html that deals with the subject of friend functions and friend classes in C++. My question is, when When is it prudent to use friendship when creating a program? The only clue I g...

Using PHP and MySQL, how to structure a "Friendship" in database for a community website?

For community websites like Facebook, myspace, etc.. They have a feature called "Friendship", means you can add friends, send "add friends request", etc.. How to structure it in database? I means, what tables required? What are the columns for each table required? ...

Is friendship inherited in C++?

Suppose I have a Base class: class Base { friend SomeOtherClass; }; And there is another (different) class that inherits from Base: class AnotherClass : public Base {} Is friendship inherited as well? Thank you ...

How do I find/make programming friends?

I recently got my first programming internship and was extremely excited to finally be able to talk with and interact with fellow programmers. I had this assumption that I would find a bunch of like minded individuals who enjoyed programming and other aspects of geek culture. Unfortunately, I find myself working with normal people who pr...

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 invert (const Matrix &); //.. }; Xform x; // error: no Xform in scope Matrix (*p...

Friend of a friend in PHP/MySQL?

Ok I have searched before asking, all I found was several questions asking what I am but 0 answers so maybe someone who knows will see this or I will make it a more clear question. I have a social network similar to myspace/facebook. In my code you are either a person's friend or not a friend, so I show all actions from people you are f...

Best way to show friends of a user in alphabetical order

On a social network I am working on in PHP/MySQL, I have a friends page, it will show all friends a user has, like most networks do. I have a friend table in mysql, it only has a few fields. auto_ID, from_user_ID, to_friend_ID, date I would like to make the friends page have a few different options for sorting the results, 1) By auto...

user has many :users, or must I use another way for a friend based social network?

Hi, I'm creating a little social network in Rails, where people can add eachother as a friend. I have created a model called 'user', which contains, e-mail, strong md5 hash with salt of password etc... My question is: how do I create something like an option to add another user as a friend. Is it possible to have something like has_man...

Rails belong_to :foreign_key. I need some mysql logic in the foreign key

I would need a dynamic foreign key. What I mean? When frienships.profile_id = 1, then the foreign key is friend_id, when is frienships.friend_id = 1, the foreign key is profile_id Im using this, but is not working. has_many :removed_friends, :foreign_key => "(CASE WHEN friendships.profile_id = #{self.id} THEN friend_id ELSE profile_id ...

friendship and operator overloading help

hello there, I have the following class #ifndef Container_H #define Container_H #include <iostream> using namespace std; class Container{ friend bool operator==(const Container &rhs,const Container &lhs); public: void display(ostream & out) const; private: int sizeC; // size of Container int capacityC; ...

Call a function in class members (C++)

Consider the following: These classes are in different header files and each header file has its corrresponding source files. //------------------------------------------ // in Z.h class Z { public: Z(); ~Z(); void DoSomethingNasty(); } //------------------------------------------ // in X.h class X { public: X();...

How to ? Storing and retrieving Friends Activities relationship in Events table

Hi everyone, im trying this concept of building a friend system for my application.I have some sucess in designing a database table for storing message a member updates in his profile. This is the table model. Message_id|Message|Message_Author This is the table model to hold further message that belongs to a particular message. F...

MySQL: InnoDB |OR| MyISAM ?

I have two tables: Users and Friendships. The actions I have in the website are: Register Log in Select friends/people from users table Add people as friends There are a little more actions but in general i wanted to know : The Question: Should I use InnoDB or MyISAM for the tables ? ( Or InnoDB for one and MyISAM for the other ? ...