Hello Daniel,
On May 08, 97, Daniel McGregor of 1:140/237.2 wrote to Jerry Coffin
DM> Hello Jerry!
DM>> The last I checked in my compiler (Turbo C++ 3.1) "struct"
DM>> wouldn't let you use member functions while class would.
DM> Its the compilers bug. And I lied, its TC++ 3.0.
Hmm, I won't say you're lying again ;-)) but a struct with TC++ 3.0 for Dos
works perfectly well in C++, hence the following code:
// structst.cpp Remember to use the cpp extension otherwise some Borland
// compilers will think its plain ol' 'C'
#include
struct OpenClass {
int x, y;
OpenClass(int X, int Y) : x(X), y(Y) { }
~OpenClass() { }
void print();
};
void OpenClass::print()
{
printf("\nNumbers in struct: %d, %d\n", x, y);
}
int main()
{
OpenClass t(10,20);
t.print();
return 0;
}
// end of example **********************
This works, as said, perfectly well in TC++ 3.0 for Dos here in Amsterdam.
Perhaps that that has something to do with it...
DM> Daniel
CU on screen, Jan
email: bijster@worldonline.nl
http://www.worldonline.nl/~bijster
--- MBM v3.41e
---------------
* Origin: Snuffelaar bij DosBoss West (2:500/121.5122)
|