M
Michael Bell
Here is the first program from Pardoe & King. It makes an assumption
that I cannot untangle: There is only one instance of the class
message. How do I create two messages, say "Welcome" and "Goodbye"?
Although I can see why it is like this, I feel it is unwise for a
first example to be a special case.
Michael Bell
/---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
// #include <string.h> // Not necessary in Borland
// #include "MT262io.h"
#include <iostream> // Enables cout
using namespace std; // Enables cout
class message
{
public :
void initialise ();
void display();
protected :
char contents[12];
};
void message::initialise()
{
strcpy (contents, "Hello world");
}
void message::display ()
{
cout << contents << endl;
}
#pragma argsused
int main(int argc, char* argv[])
{
message hello;
hello.initialise();
hello.display();
getchar(); // screenholder from MT262
return 0;
}
//------------------------------------------------
--
that I cannot untangle: There is only one instance of the class
message. How do I create two messages, say "Welcome" and "Goodbye"?
Although I can see why it is like this, I feel it is unwise for a
first example to be a special case.
Michael Bell
/---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
// #include <string.h> // Not necessary in Borland
// #include "MT262io.h"
#include <iostream> // Enables cout
using namespace std; // Enables cout
class message
{
public :
void initialise ();
void display();
protected :
char contents[12];
};
void message::initialise()
{
strcpy (contents, "Hello world");
}
void message::display ()
{
cout << contents << endl;
}
#pragma argsused
int main(int argc, char* argv[])
{
message hello;
hello.initialise();
hello.display();
getchar(); // screenholder from MT262
return 0;
}
//------------------------------------------------
--