Skip to content
Sign in
Computer PPSC

Which of the following terms is used for a function defined inside a class?

Tap an option to check the answer. You can also press A–D.

Show answer

Correct answer: B) Member function

In object-oriented programming, a function defined inside a class is called a member function. Member functions operate on the data of the class, while a member variable is a variable declared inside the class. The terms class function and classic function are not standard terms for this concept. Related facts: Member functions are also commonly called methods. Member variables are also called data members or attributes. Constructors and destructors are special types of member functions. Exam tip: Link the pair together: data declared in a class is a member variable, and a function declared in a class is a member function.
Explanation
In object-oriented programming, a function defined inside a class is called a member function. Member functions operate on the data of the class, while a member variable is a variable declared inside the class. The terms class function and classic function are not standard terms for this concept. Related facts: Member functions are also commonly called methods. Member variables are also called data members or attributes. Constructors and destructors are special types of member functions. Exam tip: Link the pair together: data declared in a class is a member variable, and a function declared in a class is a member function.