Click here to Skip to main content
15,890,995 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Paste gif, jpg images Pin
Filomela26-Mar-04 4:55
Filomela26-Mar-04 4:55 
GeneralAuthenticate the remote user credentials Pin
Mr Bose Dayala27-Jan-04 19:47
Mr Bose Dayala27-Jan-04 19:47 
GeneralFocus problem! Pin
rohit.dhamija27-Jan-04 19:28
rohit.dhamija27-Jan-04 19:28 
GeneralRe: Focus problem! Pin
Antti Keskinen27-Jan-04 21:15
Antti Keskinen27-Jan-04 21:15 
GeneralMore Help Plz Pin
MrNiceBerG27-Jan-04 18:39
MrNiceBerG27-Jan-04 18:39 
GeneralTrying to capture the screen, Getting some Error Pin
santosh k27-Jan-04 18:24
santosh k27-Jan-04 18:24 
GeneralRe: Trying to capture the screen, Getting some Error Pin
Diddy28-Jan-04 22:40
Diddy28-Jan-04 22:40 
GeneralClass/Overloaded funtion help Pin
tekkie241227-Jan-04 16:29
tekkie241227-Jan-04 16:29 
Im reading "teach yourself C++ in 21 days", well Ive been stuck on day 6 for about a week now. Can anyone tell me whats wrong with this source? I keep getting overloaded function errors but I really want to understand this before I move on to day 7. thanks

/*
Chapter 6 end of lesson program
Teach yourself C++ in 21 days
*/


// simple program to test my knowlege of classes...
// make a class that assignes and reads values using public accessors

#include <iostream.h>

class Employee
{
public:
int GetAge() const;
void SetAge(int age);
int GetYearsOfService() const;
void SetYearsOfService(int yearsOfService) const; //Public accessors so that the variables can remain private
int GetSalary() const;
void SetSalary(int salary);
private:
int age;
int yearsOfService; //Private variables
int salary;

};

int Employee::GetAge()
{
return age;
}
void Employee::SetAge(int age2)
{
age = age2;
}
int Employee::GetYearsOfService()
{
return yearsOfService;
}
void Employee::SetYearsOfService(int yearsOfService2)
{
yearsOfService = yearsOfService2
}
int Employee::GetSalary()
{
return salary;
}
void Employee::SetSalary(int salary2)
{
salary = salary2;
}


void main()
{
int age2, yearsOfService2, salary2;

Employee Matt; //define 2 objects of class employee
Employee Max;

Matt.SetAge(21);
Max.SetAge(35);
Matt.SetYearsOfService(2); //assign values to the 2 objects
Max.SetYearsOfService(6);
Matt.SetSalary(20000);
Max.SetSalary(34600);

cout<<"Matts age is : ";
cout<<Matt.GetAge() <<"\n";
cout<<"Maxs age is : ";
cout<<Max.GetAge() <<"\n";
cout<<"Matts salary is : ";
cout<<Matt.GetSalary() <<"\n"; //output the above values
cout<<"Maxs salary is : ";
cout<<Max.GetSalary() <<"\n";
cout<<"Matts years of service is : ";
cout<<Matt.GetYearsOfService() <<"\n";
cout<<"Maxs years of service is : ";
cout<<Max.GetYearsOfService() <<"\n";
}

thanks for any help or advice
GeneralRe: Class/Overloaded funtion help Pin
Michael Gunlock27-Jan-04 16:45
Michael Gunlock27-Jan-04 16:45 
GeneralRe: Class/Overloaded funtion help Pin
tekkie241228-Jan-04 13:45
tekkie241228-Jan-04 13:45 
Generalsort item in tree control Pin
kendao27-Jan-04 16:21
kendao27-Jan-04 16:21 
GeneralRe: sort item in tree control Pin
Prakash Nadar27-Jan-04 18:55
Prakash Nadar27-Jan-04 18:55 
GeneralLVN_GETDISPINFO Using SendMessage Pin
fordge27-Jan-04 16:05
fordge27-Jan-04 16:05 
GeneralRe: LVN_GETDISPINFO Using SendMessage Pin
Mike Nordell28-Jan-04 0:35
Mike Nordell28-Jan-04 0:35 
Generalparallel port Pin
Member 64882827-Jan-04 15:10
Member 64882827-Jan-04 15:10 
GeneralRe: parallel port Pin
Antti Keskinen27-Jan-04 19:35
Antti Keskinen27-Jan-04 19:35 
GeneralRe: parallel port Pin
Member 64882828-Jan-04 5:33
Member 64882828-Jan-04 5:33 
GeneralRe: parallel port Pin
Antti Keskinen28-Jan-04 6:42
Antti Keskinen28-Jan-04 6:42 
GeneralRe: parallel port Pin
Member 64882829-Jan-04 15:34
Member 64882829-Jan-04 15:34 
GeneralRe: parallel port Pin
Antti Keskinen30-Jan-04 6:30
Antti Keskinen30-Jan-04 6:30 
GeneralDetecting UPS State Pin
Blake Miller27-Jan-04 15:01
Blake Miller27-Jan-04 15:01 
GeneralRe: Detecting UPS State Pin
David Crow28-Jan-04 2:33
David Crow28-Jan-04 2:33 
GeneralWierd thing with caption... Pin
Snyp27-Jan-04 14:44
Snyp27-Jan-04 14:44 
GeneralRe: Wierd thing with caption... Pin
alex.barylski27-Jan-04 18:33
alex.barylski27-Jan-04 18:33 
GeneralRe: Wierd thing with caption... Pin
Antti Keskinen27-Jan-04 21:50
Antti Keskinen27-Jan-04 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.