The Gateway to Computer Science Excellence
0 votes
493 views

Functions defined with class name are called as

  1. Inline Function
  2. Friend Function
  3. Constructor
  4. Static Function
in Others by Veteran (105k points)
retagged by | 493 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).
by Loyal (7.2k points)
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

by Boss (41k points)
0
@LeenSharma Sir,Inline Function is a wrong answer. Constructor is the right one. :)

Related questions

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
50,647 questions
56,496 answers
195,488 comments
100,796 users