#include<iostream.h>
class Exforsys();
{
private:
int a;
public:
Exforsys()
{}
Exforsys(int w)
{
a=w;
}
Exforsys(Exforsys& e)
{
a=e.a;
cout<<"Example of Copy Constructor";
}
void result()
{
cout<<a;
}
void main()
{
Exforsys e1(50);
Exforsys e3(e1); cout<<"\ne3="; e3.result();
}
}
itpipx
0
Newbie Poster
Recommended Answers
Jump to Post3 problems
Declaration of a copy constructor should be of a const reference variable parameter and not just a reference variable parameter--
Exforsys(const Exforsys& e)
--you might get away with it during compile/run but your professor may dock you points.
second, not sure if void …
Jump to PostYou need to have a global main too.
::main();
And please use code tags around your code, it helps those who wants to help you :)
All 5 Replies
Intrade
33
Junior Poster
vidit_X
29
Junior Poster
stevanity
4
Posting Whiz in Training
Intrade
33
Junior Poster
itpipx
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.