Re: As a programmer of both languages...



jacob navia said:

Ian Collins wrote:
jacob navia wrote:
Ian Collins wrote:
jacob navia wrote:

The difference between C and C++ is the object orientation of C++. C
is not object oriented.

Are you really dense, or just being obtuse? As you have been told
many
times before, C++ is a multi paradigm language. You can *choose* to
write OO or procedural code in C++.

You can't program in C++ without using classes. Even if you define
a simple structure it is actually a class.

Your ignorance continues to astound. Maybe you should take some time
out and learn C++ before slagging it off.


Yes Sir!

struct A {
int age;
char *Name;
};

int main(void)
{
A jacob;
}

This is valid C++ but invalid C.

Yes, for reasons which have nothing to do with classes.


In C++ each "structure" definition
is just a CLASS where all members are PUBLIC by default.

Stroustrup says much the same thing, albeit more quietly. But it can be
said just as correctly (or incorrectly) that, in C++, each "class"
definition is just a struct where all members are private by default. So
if the claim is that C++ is "all about classes" (which I don't accept),
then it can just as logically be said that C++ is "all about structs".
And, just as it is possible in C to write programs - *useful* programs -
that don't use structs, so it is possible in C++ to write useful programs
that don't use classes.

I see this
explanation in all C++ books I read but in my ignorance I believe
them. Stupid isn't it?

Yes - if you really want to know what a C++ struct is, the place to look is
ISO/IEC 14882.

<snip>

If you write

int main(void) { printf("hello\n");}

you do not need classes but is it C++?

The behaviour of that program, either in C or in C++, is undefined. (I
believe that C++ even requires a diagnostic message to be produced during
translation of that program.) If you want people to treat your views about
C seriously, you might want to start off by learning enough about C that
you can write a simple "hello" program properly.


<snip>


--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages