Govind’s blog


A friend in need is a friend indeed means a friend in need is a true friend.

Friendship described with discipline and practiced with immortal faith. True friendship is invaluable and found rarely.

Friendship means exploring beauty of emotions.

Basically, he is trying to correlate the computer world and real world. He is trying to making the base of friend functions through the real life world because he know that our mind holds things in two ways

  1. Visual ways(through pictures).
  2. Base(in Hindi – neev)

He likes C++ language a lot not because he has adapted it’s power or rules rather it is the first programming language he learnt.

He distinctly remember the circumstances leading to this delicious learning journey.

Ohh No, the new semester is going to be start and half book is yet to be read.

The above talk was his past but now again he has keen power to explore beauty of C++

So, below I’ll write the summary of it as you know the motive of writing this blog.

“Computer programming is nothing but a simulation(representation to computer program) of the human mind, experiences, challenges and goals”.

Friends in C++:

A class contains all types of data i.e. public, private, protected. Analogy, there are things that man can share publicly, private(with family members and friends).

To know the secrets of a man be a family member is not so easy and always but being a friend is much easy. Isn’t it?

Just re-declare that function inside the class body (you must not re-define it, that’d be a syntax error) and use the keyword “friend” in this declaration. The re-declaration must be in the public section of the class definition.

Friend function can access the private and protected data of the class through the objects.

The defination of a friend function should be in the same file.
Limitations of Friendship:
  1. Friendship is not implicitly reciprocated. If class A is a friend to class B then the inverse is not true. That would need an explicit desire from the programmer.2. A derived class does not inherit the friendship of its parents. If your parents are friends with someone, then that does not mean you should be friends with them too, does it?
  2. A friend function (or class) cannot be extern. This means that friend functions need to be defined in the same file as their friend class. You cannot declare a function defined in some other file as the friend of a class. Vicinity is a necessity for friendship.
  3. A friend function must not be static because static function are used without objects(contradicts the point of accessing data of class through objects).

Hope I was able to make you clear th objective of his blog.

Thankyou for tolerating me.;)



2 thoughts on “F.R.I.E.N.D.S.

  1. I was talking about how a computer works: with discipline, without any sentiments i.e. electronic in nature. One such example of this behavior is in the case of function being a friend of a class.
    Simulation does not mean analogy, at least not here.
    Nice work otherwise. I appreciate it.

    P.S. Vegetables are invaluable too. Use something else to explain your point, something which is really not that important.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s