Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a function in oop?

1081


What is overriding in oops?

1102


Why interface is used?

1015


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

4933


What is the main feature of oop?

1147


What is polymorphism what is it for and how is it used?

1013


What is oops and its features?

1076


How is class defined?

1132


What is debug class?what is trace class? What differences are between them? With examples.

2189


What is polymorphism and example?

1044


What are the advantages of polymorphism?

1027


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1633


What does enum stand for?

1114


Templates mean

2079


What is cohesion in oop?

1052