kovan
Oct 10th, 2000, 01:01 PM
i get error that sayis 'Person' undelcared identifier
and aslo that left of all my functions/routines
that i "must have class/struct/union type"
anyone could help, would greatly appreciated it
#include <iostream>
using namespace std;
int main(void)
{
Person Kovan;
Kovan.SetName("Kovan");
Kovan.SetAge(20);
Kovan.SayAge();
Kovan.SayName();
Kovan.Greeting1();
Kovan.GoodBye();
int retval;
cin >> retval;
return retval;
}
class Person
{
public:
void SetName(char* chrName);
void SetAge(int Age);
char* GetName();
void Greeting1();
void SayName();
void GoodBye();
void SayAge();
private:
char* pName;
unsigned int pAge;
};
void Person::SetAge (int Age){
pAge = Age;
}
void Person::SetName(char* chrName)
{
pName = chrName;
}
char* Person::GetName()
{
return pName;
}
void Person::Greeting1()
{
cout << "hi there how are you doing?" << endl;
}
void Person::SayName()
{
cout << pName << endl;
}
void Person::GoodBye()
{
cout << "See Ya Later" << endl;
}
void Person::SayAge()
{
cout << pAge << endl;
}
and aslo that left of all my functions/routines
that i "must have class/struct/union type"
anyone could help, would greatly appreciated it
#include <iostream>
using namespace std;
int main(void)
{
Person Kovan;
Kovan.SetName("Kovan");
Kovan.SetAge(20);
Kovan.SayAge();
Kovan.SayName();
Kovan.Greeting1();
Kovan.GoodBye();
int retval;
cin >> retval;
return retval;
}
class Person
{
public:
void SetName(char* chrName);
void SetAge(int Age);
char* GetName();
void Greeting1();
void SayName();
void GoodBye();
void SayAge();
private:
char* pName;
unsigned int pAge;
};
void Person::SetAge (int Age){
pAge = Age;
}
void Person::SetName(char* chrName)
{
pName = chrName;
}
char* Person::GetName()
{
return pName;
}
void Person::Greeting1()
{
cout << "hi there how are you doing?" << endl;
}
void Person::SayName()
{
cout << pName << endl;
}
void Person::GoodBye()
{
cout << "See Ya Later" << endl;
}
void Person::SayAge()
{
cout << pAge << endl;
}