Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
656 views
in Information Technology by (72.7k points)
closed by

In C++, casting operator function should satisfy, which of the following conditions?

I: It must be a member of a class

II: It must not specify a return type

III: It must not have any argument 


1. I and II only
2. I, II and III
3. I and III only 
4. II and II only

1 Answer

0 votes
by (121k points)
selected by
 
Best answer
Correct Answer - Option 2 : I, II and III

A cast is a special operator that forces one data type to be converted into another. As an operator, a cast is unary and has the same precedence as any other unary operator.

Syntax

(type) expression

For Example

#include <iostream>

using namespace std;

main() {

double a = 19.07795;

float b = 8.054;

int m ;

m = (int) a;

cout << " (int)a is :" << m << endl ;

m = (int) b;

cout << " (int)b is :" << m << endl ;

return 0;

}

Output is

 (int)a is :19

 (int)b is :8

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...