Click here to Skip to main content
15,898,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is there a way to switch focus?? Pin
Kiran Satish5-Oct-07 7:33
Kiran Satish5-Oct-07 7:33 
GeneralRe: Is there a way to switch focus?? Pin
Mark Salsbery5-Oct-07 7:38
Mark Salsbery5-Oct-07 7:38 
GeneralRe: Is there a way to switch focus?? Pin
Kiran Satish5-Oct-07 9:36
Kiran Satish5-Oct-07 9:36 
GeneralRe: Is there a way to switch focus?? Pin
Mark Salsbery5-Oct-07 9:42
Mark Salsbery5-Oct-07 9:42 
GeneralRe: Is there a way to switch focus?? Pin
Kiran Satish5-Oct-07 9:51
Kiran Satish5-Oct-07 9:51 
GeneralRe: Is there a way to switch focus?? Pin
Mark Salsbery5-Oct-07 10:08
Mark Salsbery5-Oct-07 10:08 
GeneralRe: Is there a way to switch focus?? Pin
Kiran Satish8-Oct-07 5:55
Kiran Satish8-Oct-07 5:55 
QuestionDeque using elements from a class Pin
PolarFuzz4-Oct-07 5:10
PolarFuzz4-Oct-07 5:10 
Does anyone know how to add and retrieve the objects of a class to/from a deque container? I am building a larger project with a similar problem but I cannot even get the basics to work.

int main ()		{
	deque<int> Test2;  // Basic deque works fine
	Test2.push_back(3);
	Test2.push_back(4);
	Test2.push_back(5);
<p></p>
	Patient p;
	deque< Patient> TestQue;  // Trouble is Here!!!
<p></p>
	p.SetAge("20");
	p.SetName("Dave");
	p.SetCode("GEN");
<p></p>
	TestQue.push_back(p);  // Compiles okay, seems to add instance of class to deque: TestQue
<p></p>
       cout << "Test: " << TestQue[0];  // I cannot retrieve class objects, does not compile
<p></p>
	cout << "Test: " << Test2[0] << " " << Test2[1] << " " << Test2[2] << "\n";  // This works okay
<p></p>
	system ("pause");
return EXIT_SUCCESS;
}


********************************************************
"Patient.h" procedure below:
This is part of a doctor class but I don't need it for this particular question.
********************************************************

class Patient	{

private:
	char* LastName;
	char* Age;
	char* Code;
	
public:
	Patient();
	Patient (char *, char *, char *);
	
	void SetName(char *);
	void SetAge(char *);
	void SetCode(char *);
	
	char* GetName();
	char* GetAge();
	char* GetCode();

	~Patient();
};


********************************************************
Patient Procedure Below
********************************************************

#include "Patient.h"

//Patient Constructor defaulting everything to Null.
Patient::Patient()	{
	LastName = NULL;
	Age = NULL;
	Code = NULL;
}

Patient::Patient(char *last, char *age, char *code)	{
	LastName  = _strdup(last);
	Age   = _strdup(age);
	Code   = _strdup(code);
}

void Patient::SetName   (char* last) { LastName = _strdup(last); }

void Patient::SetAge   (char* age) { Age = _strdup(age);  }

void Patient::SetCode   (char* code) { Code = _strdup(code);  }
<p></p>
char* Patient::GetName()  { return LastName; }
char* Patient::GetAge()	  { return Age; }
char* Patient::GetCode()  { return Code; }

QuestionRe: Deque using elements from a class Pin
David Crow4-Oct-07 5:33
David Crow4-Oct-07 5:33 
AnswerRe: Deque using elements from a class [modified] Pin
George L. Jackson4-Oct-07 5:54
George L. Jackson4-Oct-07 5:54 
GeneralRe: Deque using elements from a class Pin
led mike4-Oct-07 6:20
led mike4-Oct-07 6:20 
GeneralRe: Deque using elements from a class Pin
George L. Jackson4-Oct-07 6:32
George L. Jackson4-Oct-07 6:32 
GeneralRe: Deque using elements from a class Pin
led mike4-Oct-07 7:20
led mike4-Oct-07 7:20 
AnswerRe: Deque using elements from a class Pin
led mike4-Oct-07 6:17
led mike4-Oct-07 6:17 
AnswerRe: Deque using elements from a class Pin
John R. Shaw4-Oct-07 12:24
John R. Shaw4-Oct-07 12:24 
GeneralRe: Deque using elements from a class Pin
PolarFuzz5-Oct-07 8:35
PolarFuzz5-Oct-07 8:35 
GeneralRe: Deque using elements from a class Pin
John R. Shaw5-Oct-07 21:57
John R. Shaw5-Oct-07 21:57 
GeneralRe: Deque using elements from a class Pin
PolarFuzz8-Oct-07 2:05
PolarFuzz8-Oct-07 2:05 
Questionwhat is the API that MS Office is calling to save a file under a different name ? Pin
carabutnicolae12344-Oct-07 5:07
carabutnicolae12344-Oct-07 5:07 
QuestionRe: what is the API that MS Office is calling to save a file under a different name ? Pin
David Crow4-Oct-07 5:34
David Crow4-Oct-07 5:34 
AnswerRe: what is the API that MS Office is calling to save a file under a different name ? Pin
carabutnicolae12344-Oct-07 5:52
carabutnicolae12344-Oct-07 5:52 
GeneralRe: what is the API that MS Office is calling to save a file under a different name ? Pin
David Crow4-Oct-07 6:38
David Crow4-Oct-07 6:38 
AnswerRe: what is the API that MS Office is calling to save a file under a different name ? Pin
Mark Salsbery4-Oct-07 5:53
Mark Salsbery4-Oct-07 5:53 
GeneralRe: what is the API that MS Office is calling to save a file under a different name ? Pin
carabutnicolae12344-Oct-07 6:06
carabutnicolae12344-Oct-07 6:06 
GeneralRe: what is the API that MS Office is calling to save a file under a different name ? Pin
Mark Salsbery4-Oct-07 6:13
Mark Salsbery4-Oct-07 6:13 

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.