I
Ian Collins
What's your point? The fact that struct is close to a synonym for classjacob said:Yes Sir!
struct A {
int age;
char *Name;
};
int main(void)
{
A jacob;
}
This is valid C++ but invalid C. In C++ each "structure" definition
is just a CLASS where all members are PUBLIC by default. I see this
explanation in all C++ books I read but in my ignorance I believe
them. Stupid isn't it?
is irrelevant. Your example struct is equally valid in both languages,
C++ treats it exactly the same as C. Saying you can't write anything
useful in C++ without classes is like saying you can't write anything
useful in C without using structs. In both languages we represent
collections of data in structures.
You are just playing word games, a favorite sport in this group.
Of course you can write programs in C and compile them with C++,
modulo some differences it is possible.
That's not what I said. Are function templates OO? Is function
overloading OO? Are exceptions OO?
Does your beloved operator overloading make sense without structs?
Many of the C++ standard library algorithms work equally well withI would be surprised that you
can use the STL without using implicitly a class!!!
pointers. Very little of the STL is OO, which ironically is a common
criticism of it from OO purists.
All of the extensions to C you keep pushing are available in standard
C++, today.