[...]
I've written this code in 2 mins.Excuse me if it contains some
imprecisions.
So :
-I've used struct because I didn't want to type
class X
{
public:
//...
};
That's all.For me, the only difference between struct and class is the
default visibility of members.
Is it true ?
Yes, and using struct in cases where we are discussing language
issues where access is not the question (and we are not
developing real code) is a widespread convention.
-main-.
In my small prog, I don't use argc and argv.So I prefer use (void) instead
of (int argc,char *argv[])
-(void) instead of ()
I had written a lot of C code before I started to use C++. So I'm used to
write (void) instead of ().
I know it's a mistake but not a huge one.
Not a "mistake" as such, but it does tend to mark you as a "C
hacker", rather than a C++ programmer. (I'll admit that I never
got into the habit because I started using C++ before I had
access to ANSI C compilers.) The original C++ compilers didn't
allow void here---the language was only extended to support it
for reasons of C compatibility. (For that matter, a lot of
people in the C community didn't like the void here either. It
was just that there was no other way of doing it without
breaking every C program in existance at the time. A necessary
evil, and not something to be proud of.)