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

Why do we use inheritance?

1132


Write a c++ program to display pass and fail for three student using static member function

3400


What is abstraction in oop with example?

1133


Whats oop mean?

1050


How to hide the base class functionality in Inheritance?

1139


What is the example of polymorphism?

1132


What is super in oop?

1176


What is multilevel inheritance explain with example?

1149


What is difference between abstraction and encapsulation?

1083


What is polymorphism give a real life example?

1038


Which language is pure oop?

1012


What is meant by oops concept?

1044


What is interface in oop?

1130


What is the fundamental idea of oop?

1141


What is the real life example of polymorphism?

1177