By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,965 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,965 IT Pros & Developers. It's quick & easy.

solve the problem

P: 7
What is function overloading Is it possible to overload constructor if Yes give complete example of constructor overloading, if No justify your answer.
Jun 12 '07 #1
Share this Question
Share on Google+
1 Reply


gpraghuram
Expert 100+
P: 1,275
HI,
You can do constructor overloading,
Expand|Select|Wrap|Line Numbers
  1. class A
  2. {
  3. int x;
  4. int y;
  5. public:
  6. A()
  7. {
  8.  x=y=0;
  9. }
  10. A(int _x,int _y):x(_x),y(_y){}
  11. };
  12.  
This is constructor overloading.

Thanks
Raghuram
Jun 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.