-
February 28th, 2009, 04:58 AM
#1
Plz Dedect Errors
I am beginners in C++. i have made the following code but it is giving a few errors i am unable to remove them plz indicate it and rectify it.
#include<iostream>
using namespace std;
class Date
{
private:
int day;
int month;
int years;
public:
void setDay(int i);
void setMonth(int i);
void setYears(int i);
int getDay();
int getMonth();
int getYears();
void display();
Date();
Date(int,int);
Date(int,int ,int);
~Date();
};
Date:ate()
{ day =1;
month = 2;
years =2001;
cout<<"The default constructor called"<<endl; }
Date:ate(int d,int m)
{
day = d;
month = m;
years = 2000;
cout<<"The two parametrized constroctor called"; }
Date:ate(int theDay, int theMonth , int theYears=2002)
{ day = theDay;
month = theMonth;
years = theYears;
cout<<"The three parametrized constructor called"<<endl;}
Date::~Date( )
{cout<<"I am distroctor"<<endl;}
void Date::setDay(int i)
{i = day; }
void Date::setMonth(int i)
{ i = month;}
void Date::setYears(int i )
{ i = years; }
int Date::getDay()
{ return day; }
int Date::getMonth()
{ return month; }
int Date::getYears()
{ return years; }
void Date:isplay()
{ cout<<"The date is:"<<day<<"-"<<month<<"-"<<years<<endl; }
int main() {
Date dist1,dist2(4,12),dist3(23,3,2009);
dist1.display();
dist2.display();
dist3.display();
}
-
February 28th, 2009, 06:53 AM
#2
Re: Plz Dedect Errors
Not going to help until 3 things happen....
1) You wrap that up in code tags to preserve indenting,
2) You tell us what the errors are, and
3) You give some indication of *where* the errors are since we don't want to have to count line numbers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|