Click here to Skip to main content
15,917,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Writing Data to Files Pin
JonEngle19-Oct-05 11:49
JonEngle19-Oct-05 11:49 
GeneralRe: Writing Data to Files Pin
Achim Klein19-Oct-05 12:30
Achim Klein19-Oct-05 12:30 
GeneralRe: Writing Data to Files Pin
Sweet Flame19-Oct-05 12:54
Sweet Flame19-Oct-05 12:54 
GeneralRe: Writing Data to Files Pin
Anonymous19-Oct-05 13:18
Anonymous19-Oct-05 13:18 
GeneralRe: Writing Data to Files Pin
Sweet Flame19-Oct-05 14:37
Sweet Flame19-Oct-05 14:37 
GeneralRe: Writing Data to Files Pin
Achim Klein19-Oct-05 13:22
Achim Klein19-Oct-05 13:22 
GeneralRe: Writing Data to Files Pin
Sweet Flame19-Oct-05 14:38
Sweet Flame19-Oct-05 14:38 
GeneralRe: Writing Data to Files Pin
Achim Klein19-Oct-05 13:28
Achim Klein19-Oct-05 13:28 
Can you compile this ?
// --------
// Main.cpp
// --------
/**
* @file
* @brief Re: main()
* @version 0.1
*/


// --------
// Includes
// --------
#include <iostream>
#include <fstream>


// ---------------
// Used namespaces
// ---------------
using namespace std;


// -------------------------------
// Definition of the MyClass class
// -------------------------------
/**
 * Foo.
 */
class MyClass
{

public:

	// ------------
	// Construction
	// ------------

	/// standard-constructor
	MyClass();


	// -------------
	// Serialization
	// -------------

	/// writes the object to the passed stream
	ostream& write(ostream& Stream) const;


private:

	// ----------
	// Attributes
	// ----------

	/// the first member
	int m_first;

	/// the second member
	int m_second;

	/// the third member
	int m_third;
};


// -------
// MyClass
// -------
/**
 * The standard-constructor.
 */
MyClass::MyClass()
{
	m_first  = 1;
	m_second = 2;
	m_third  = 3;
}


// -----
// write
// -----
/**
 * Writes the object to the passed stream.
 */
ostream& MyClass::write(ostream& Stream) const
{
	return Stream << "first  : " << m_first  << endl
	              << "second : " << m_second << endl
	              << "third  : " << m_third;
}


// ----------
// operator<<
// ----------
/**
 * ostream << MyClass
 */
ostream& operator<<(ostream& Stream, const MyClass& Object)
{
	return Object.write(Stream);
}


// ----
// main
// ----
/**
 * The application starts here.
 *
 * @param argc number of arguments
 * @param argv list of arguments
 *
 * @return 0 if finished successfully
 */
int main(int argc, char** argv)
{
	// ofstream cout("cout.txt");

	cout << MyClass() << endl;

	return 0;
}



We can do no great things, only small things with great love. - Mother Theresa
GeneralRe: Writing Data to Files Pin
Sweet Flame19-Oct-05 14:40
Sweet Flame19-Oct-05 14:40 
GeneralRe: Writing Data to Files Pin
Achim Klein19-Oct-05 15:20
Achim Klein19-Oct-05 15:20 
AnswerRe: Writing Data to Files Pin
David Crow20-Oct-05 5:01
David Crow20-Oct-05 5:01 
GeneralRe: Writing Data to Files Pin
Achim Klein20-Oct-05 5:31
Achim Klein20-Oct-05 5:31 
GeneralRe: Writing Data to Files Pin
David Crow20-Oct-05 6:33
David Crow20-Oct-05 6:33 
Questionregarding using a class as a member of another class. Pin
knightz10119-Oct-05 10:39
knightz10119-Oct-05 10:39 
AnswerRe: regarding using a class as a member of another class. Pin
Maximilien19-Oct-05 10:59
Maximilien19-Oct-05 10:59 
AnswerRe: regarding using a class as a member of another class. Pin
User 58385219-Oct-05 15:34
User 58385219-Oct-05 15:34 
QuestionMaking a program core dump in Windows Pin
Andrei B19-Oct-05 10:14
Andrei B19-Oct-05 10:14 
AnswerRe: Making a program core dump in Windows Pin
Shog919-Oct-05 10:53
sitebuilderShog919-Oct-05 10:53 
QuestionError code 0 while sending on socket Pin
FASTian19-Oct-05 9:31
FASTian19-Oct-05 9:31 
QuestionRe: Error code 0 while sending on socket Pin
David Crow19-Oct-05 10:08
David Crow19-Oct-05 10:08 
AnswerRe: Error code 0 while sending on socket Pin
FASTian19-Oct-05 19:58
FASTian19-Oct-05 19:58 
AnswerRe: Error code 0 while sending on socket Pin
User 58385219-Oct-05 21:11
User 58385219-Oct-05 21:11 
QuestionMFC Dialog in Static Library Pin
clintsinger19-Oct-05 8:39
clintsinger19-Oct-05 8:39 
AnswerRe: MFC Dialog in Static Library Pin
Shog919-Oct-05 11:43
sitebuilderShog919-Oct-05 11:43 
GeneralRe: MFC Dialog in Static Library Pin
clintsinger19-Oct-05 14:06
clintsinger19-Oct-05 14:06 

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.