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 do you mean by variable?
What is oops and why we use oops?
What is polymorphism and why is it important?
What is class and object in oops?
What is meant by oops concept?
What is encapsulation selenium?
What is inheritance and how many types of inheritance?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is coupling in oops?
What are main features of oop?
What is encapsulation in ict?
Is html an oop?
Are polymorphisms mutations?
What are the two different types of polymorphism?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.