answersLogoWhite

0


Best Answer

A normal function is any function that is not a member of any class. Normal functions that operate upon a class are referred to as non-member functions, however a non-member function can also be a member of another class. Any class may declare any non-member function to be a friend of the class, in which case the function becomes a friend function.

A member function is a member of a class and may be declared static or non-static. Non-static member functions have the following 3 properties:

  1. Private access to the class members.
  2. Scoped to the class.
  3. Must be invoked against an object of the class (has a 'this' pointer).

Static member functions have the first two properties only while friend functions have the first property only. Non-member functions that are not friends of the class have none of these properties.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

What is the difference between malloc() and calloc()?

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you differentiate between a member function and normal function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How constructor is different from normal member function?

A constructor differs from a normal member function in three ways:A constructor never returns a result. The constructor's declaration reflects this by not even declaring the function as "void." The common design hypothesis is that a well-designed constructor cannot fail, other than maybe in an irrecoverable way (such as a fatal running out of memory).A constructor is never called explicitly except with the new operator.Constructors impose further restrictions. For example, they cannot be declared abstract or virtual, and may have visibility requirements. The common design practise is that at least the default constructor is declared public.


How does friend operator function differ from member operator function?

In C++, we know that private members cannot be accessed from the outside class.That is a non-member function cannot have an access to the private data of a class.However there could be a situation where we would like two classes to share a particular function.For example consider a case where two classes, manager and scientist have been defined.We would like to use a function income_ tax () to operate on the objects of both these classes.In such situation, C++ allows the common function to be made friendly with both the classes. Such a function needs not be member of any these classes.To make outside function friendly to a class, we have to simply declare this function as a friend of a class as shown below:Class ABC{………..Public:……..……..Friend void xyz (void); //declaration};When the function is logically coupled with the class (like your maze connectedness example)When the function needs to access private or protected members, it's better to make it a member than a friend. when it's a generic function that can be templatized to naturally work on other classes (look at the header for good example) .


When is a friend function compulsory?

A normal member function has the following qualities: 1. Has private access to the class. 2. Is scoped to the class. 3. Can be invoked on an instance of the class. Static functions have the first two qualities only. Friend functions have the first quality only. It therefore follows that friend functions are only compulsory when you need quality 1 only.


What is a pure virtual member function in c plus plus?

Functions in C++ are separate procedures or subroutines within a program, that can be called as often as required and which can return values back to their callers. That is, when you make a function call, execution passes to the function and then returns to the caller. Functions that are class members are also known as member functions, member methods, or simply methods. These work exactly the same as external functions except they are scoped to the class and have access to private members of the class.


What is the purpose of the tag in HTML file?

tags are used to differentiate the text like headings, normal text

Related questions

What is the difference between friend function and normal member function?

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.


Difference between normal function inline function?

gffg


How do you differentiate between normal and abnormal personality?

Normal personality refers to patterns of behavior, thoughts, and emotions that are consistent with societal norms and do not cause significant distress or dysfunction. Abnormal personality, on the other hand, involves patterns of behavior that deviate from societal norms, cause distress or impairment in daily functioning, and may be indicative of a mental health disorder. Professional evaluation by a psychologist or psychiatrist is often necessary to make a determination.


What is the difference between a console sink and a normal sink?

To best differentiate the two look at the nut nozzle on the exterior platform of the sink. If it is wide then it is console and if it is narrow it must then be normal.


Differentiate between normal profit and economic profit?

Economic profit is when revenue exceeds total cost of inputs. Normal profit, on the other hand, is net profit less costs.


How can we differentiate between Alzheimer's and Dementia?

The difference is in the symptoms.Alzheimer Disease is a form of progressive dementia with its own syndrome and final results (death).Dementia in general refers to any progressive decline in cognitive function due to damage or disease in the brain beyond what might be expected from normal aging.


What is liddle test in cushings syndrome?

A test that administers dexamethasone to differentiate between normal and cushings Normals will be suppressed then return to normal with a low dose of dexamethasone. Affected will be suppressed with a high dose of dexamethasone


What are use of mandoor?

Man door is a slang description for a normal sized entry door at the back of a loading dock-to differentiate it between it and all the other ones for trucks.


What is the normal blood system function?

Describe the normal function of the hematic system


Differentiate between the terms reversed polarity and normal polarity?

Normal polarity is for the power to normally go from positive to negative, reverse polartity is to change the positive to a negative and the negative to a positive so the power goes the other way.


Is it normal to be in love with Wilbur Robinson?

It is normal to have strong feelings for fictional characters, as they can provide comfort and escapism. Just remember that Wilbur Robinson is a character created for entertainment, and it's important to differentiate between fiction and reality in your emotions.


Is a level of 76 normal for a liver function test?

No the range for normal LFT is between 30-49. Yours is in the higher range mine is 198!!!