Conversion from a basic type to a class type may be
achieved using______________

Answers were Sorted based on User's Feedback



Conversion from a basic type to a class type may be achieved using______________..

Answer / sujatha

Conversion from a basic type to a class type may be
achieved using SUITABLE CONSTRUCTORS IN CLASS.


EX:
class distance
{
int feet;
float inch;


public:

distance(float p) //costructor to concert basic type to
class type
{

feet= (int) p;
inch=(p-feet)*12;
}


void show()
{
cout<<"feet="<<feet;
cout<<"inch="<<inch;
}
};

void main()
{
distance d1=1.75;

d1.show();
}

out put

feet=1;
inch=9;

Is This Answer Correct ?    59 Yes 15 No

Conversion from a basic type to a class type may be achieved using______________..

Answer / safe

using object.

Is This Answer Correct ?    18 Yes 9 No

Conversion from a basic type to a class type may be achieved using______________..

Answer / mohit swami

"constructor"

for example:

class time
{
int hrs;
public:
time(int t) //constructor
{
hrs=t/60;
}
};
void main()
{
time T1; // object T1 is created
int duration=85;
T1=duration; //int to class type
}

Is This Answer Correct ?    9 Yes 3 No

Conversion from a basic type to a class type may be achieved using______________..

Answer / narmadha

object

Is This Answer Correct ?    8 Yes 3 No

Conversion from a basic type to a class type may be achieved using______________..

Answer / kaswan

well i have wrote a full article on how primitive types can
be converted to class type and class to class conversion
also.... if you want to check go ahead!
http://crazylearner.com/type-conversion-in-c/

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More OOPS Interview Questions

Which language is pure oop?

0 Answers  


Which is the best institute in hyderabad for C/C++ and it also has fast track course structure.

13 Answers   Wipro,


How to overload new operator in c++

2 Answers  


what is virtual destructor

7 Answers   L&T, TCS,


What are benefits of oop?

0 Answers  






What are the advantanges of modularity

2 Answers  


What is multilevel inheritance in oop?

0 Answers  


JAVA is FULLY OBJECT ORIENTED PROGRAMING LANGUAGE?

3 Answers  


What is the important feature of inheritance?

0 Answers   BPL,


char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output

9 Answers   Persistent,


What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass

6 Answers   Wipro,


What is coupling in oop?

0 Answers  


Categories