Conversion from a basic type to a class type may be
achieved using______________
Answer Posted / 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 |
Post New Answer View All Answers
What language is oop?
What is super in oop?
What is encapsulation oop?
What is an advantage of polymorphism?
what is different between oops and c++
is there any choice in opting subjects like 4 out of 7
What is overriding in oop?
what's the basic's in dot net
Advantage and disadvantage of routing in telecom sector
What is meant by oops concept?
What is the use of oops?
Can a destructor be called directly?
Please send ford technologies placement paper 2 my mail id
What is object and class in oops?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?