The Gateway to Computer Science Excellence
0 votes

Functions defined with class name are called as

  1. Inline Function
  2. Friend Function
  3. Constructor
  4. Static Function
in Object Oriented Programming by
recategorized | 640 views

2 Answers

+1 vote

Ans: C

A constructor is different from normal functions in following ways:

  • Constructor has same name as the class itself
  • Constructors don’t have return type
  • A constructor is automatically called when an object is created.
  • If we do not specify a constructor, C++ compiler generates a default constructor for us (expects no parameters and has an empty body).
0 votes

A member function of a class is a function that has its definition or its prototype within the class definition like any other variable. It operates on any object of the class of which it is a member, and has access to all the members of a class for that object.

Member functions can be defined within the class definition or separately using scope resolution operator, ::. Defining a member function within the class definition declares the function inline, even if you do not use the inline specifier. 

Hence,Option(A)Inline Function

@LeenSharma Sir,Inline Function is a wrong answer. Constructor is the right one. :)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,503 answers
95,334 users