1.

What is the syntax of a const member function?(a) void fun() const {}(b) void fun() constant {}(c) void const fun() {}(d) const void fun(){}I had been asked this question during an online exam.My doubt is from Types of Member Functions topic in portion Member Functions & its Types of Object Oriented Programming

Answer»

The correct OPTION is (a) void fun() CONST {}

EASY explanation - The general syntax to be followed in ORDER to declare a const function in a class is as in option a. The syntax may vary in different programming languages.



Discussion

No Comment Found

Related InterviewSolutions