C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 6)
6.
Which of the following term is used for a function defined inside a class?
Member Variable
Member function
Class function
Classic function
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
22 comments Page 1 of 3.

Oshan said:   1 decade ago
In C language-structures have different data types.
Similarly in c++ language-we have class.
Class is mainly contains two parts:

1. Data members(attributes)
(these are private to the class by default).

2. Member functions(behaviour)
Member functions can also be defined outside the class using scope resolution(::).

Syntax:
return type <class name> :: function name()

While talking about inline function then it is function defined within class itself and should contain less number of lines in its definition or it can be said as function code.

Kandrasai said:   10 years ago
Generally we define a class to represent a group of objects with similar properties. Each and every object of that class is having the same properties, to explain that properties we need some variables, functions. These are called as members of the class.

So functions of a class are called as member functions, because they are intended to explain the properties of only that members which match of their type.

Shaikh Moin Rukmoddin said:   1 decade ago
The class variables are called data members and the functions which are declared in the class is called member functions.

When member function is defined inside the class it is called as inline function.

Member function can also defined outside the class using class label. At this time it is not inline function.

RIYAJ KHAN said:   1 decade ago
When member function is defined inside the class it is called as inline function.
Member function can also defined outside the class using class label. At this time it is not inline function.

Prashant Kolhar said:   1 decade ago
A member function can be defined inside or outside of a class. if defined inside it becomes inline. for function defined outside it uses scope resolution operator :: and it's class name.

Sagar nale said:   3 years ago
It's a standard result. Functions derived inside the class are called member functions of the class, and the class variable declared inside the class is called as data member.
(4)

Md azhar hussain said:   1 decade ago
The function defined in a particular class is called as a member of a class (or) member function and the variables defined in a particular class is member variables.

Sri said:   1 decade ago
Actuvally instance variable are used in inside the class here we are talking about function so every member function will be declared in inside the class.

Manasawasthi said:   1 decade ago
Because definition of class is:

Class is a collection of data members as well as member function so the term is used member function.

Hani said:   1 decade ago
The class variables are called data members
and the functions which are declared in the class is called member functions


Post your comments here:

Your comments will be displayed after verification.