Wednesday, May 02, 2007

c++ program to show parameterized constructor

//shows parameterized constructor
#include <iostream.h>
class Gear
{
int x, y;
public:
Gear(int a, int b)
{
x = a;
y = b;
}
void showdata()
{
cout <<"The values are: " <<x <<" and " <<y;
}
};
int main(void)
{
Gear obj(3,4);
obj.showdata();
return 0;
}
--
Pradyut
http://pradyut.atwebpages.com
http://oop-edge.blogspot.com/
http://pradyutb.blogspot.com/
http://praddy-photos.blogspot.com/
http://oop-edge.spaces.live.com/
http://www.flickr.com/photos/praddy
http://groups.google.com/group/oop_programming
India



nvoids.in

blog.nvoids.in


No comments: