Top Answer
User Avatar
Wiki User
Answered 2012-03-25 21:18:44

A constructor is a method that fires when the object is instantiated. A friend function is a function that has special access to the object. They are two different types of things, and cannot be further differenced.

User Avatar

Your Answer

Related Questions

A friend constructor is a constructor that is declared a friend of another class and that grants that constructor private access to the class in which it is declared a friend. Example: class Y { friend char* X::foo (int); // friend function friend X::X (char); // constructors can be friends friend X::~X(); // destructors can be friends }; For more information, see '11.3 Friends' in the current ISO C++ Standard.

Yes, a constructor can be declared private in a class. However, in order to instantiate the class, you must include a static member function, a friend function or a friend class. The latter is often the preferred method.

We can access a Friend function from any other class in which friend function is introduced or declared even if the other class is not a member of first class. But when we use normal member function, we can have its access only in the derived classes of the first class. This is the basic difference between a friend function and a normal member function.

A virtual function is a base class function that can be overridden by a derived class. A friend function is a non-member function that has private access to the class representation.

Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.

A member function is the one which defined inside a class and is a member of the class. It may be private or public. While we can use friend function in the case when we want to one class to communicate with other class.

Assignment(=) operator is a special operator that will be provided by the constructor to the class when programmer has not provided(overloaded) as member of the class.(like copy constructor). When programmer is overloading = operator using friend function, two = operations will exists: 1) compiler is providing = operator 2) programmer is providing(overloading) = operator by friend function. Then simply ambiguity will be created and compiler will gives error. Its compilation error.

While overloading operators using member function it takes only one arguments(other pass implicitly)... but in case of friend fuction two parameters are required..

Java is pure object oriented language, and C++ is not, because you can access the private member of classes in c++ by using the friend function. There is no such function within java.

a friend will go to dinner. a good friend will bury a body.

girl friend is a friend that is girl and not a best friend and girl friend is best friend

if you are a friend you can look at their profile. if you are a fan... i dont know

a close friend is someone you can talk to, and do things with. A best friend is someone you can tell anything to.

C is not an object-oriented programming language so there is no friend keyword let alone friend constructors. In C++, however, constructors can be declared friends. Consider the following code where the class Y default constructor has private access to X::foo() because the Y::Y() constructor is explicitly declared a friend of class X. Note that Y must be defined before X can be defined, thus X must be forward declared. #include<iostream> class X; // fwd declaration class Y { public: Y() { X x;; } // X::foo is private, but Y::Y() is a friend. }; class X { friend Y::Y(); // friend constructor private: void foo() {} };

Girlfriend/Boyfriend is someone you have sex with, a friend is someone who has a friendship with you.

A friend is a family member that you have chosen and a stranger is a friend that you have not met yet.

Friend Function:A friend function is used for accessing the non-public members of a class. A class can allow non-member functions and other classes to access its own private data, by making them friends. Thus, a friend function is an ordinary function or a member of another class.Friend Class: A friend class has full access of private data members of another class without being member of that class.Ex:Class A{Private:int a, b;Friend class B;}class B{//Class B can access the private and protected data members and member's functions of class A.}

lady friend is just a friend girlfriend is a relationship or where he just wants to get her in bed and make love

How they introduce them. Friend: "This is my friend, so and so" Lover: "This is my, um, friend, so and so"

Friends are friends. But friends have different qualities, you know which friend to turn to at what point.

A friend is just a friend, and a lover is your boyfriend/girlfriend, or husband/wife. However, it helps if your partner is also your best friend!

"boys have penises, girls have vaginas" -- The kid from kindergarten cop

a facbook friend means :: you have a friend on facebook a facbook fan means that:: you love facebook

Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.