>>he thinks there's a strict definition for OOP
I made no such claim, because the definition has been shifting throughout time. However, nowadays people tend to think about everything in OOP terms because that's the only paradigm they are familiar with. And that is just stupid. At that point, there is no need to define OOP because it is void of meaning.
>good type system would be a minimum requirement
I disagree but that is beside the point.
1 week ago
Anonymous
ok show me what OOP looks like without a good type system then
That's not an example of inheritance. You are casting a pointer to a different struct and that's what gives you then access to the field.
Also you embedded wo struct inside man struct. Are you implying that every man is a little girly inside?
no idea, I don't get paid to model inheritance trees
1 week ago
Anonymous
>what OOP looks like without a good type system
C++ comes to mind. Enjoy.
1 week ago
Anonymous
My bad, I forgot that cniles are too mentally ill to understand anything that's not as shit as C, disregard anything I wrote or asked.
Yes, why would you want to use a struct instead of a class? Is just a class but limited.
A struct is just a custom data type
So class but worse.
structs are useful, moron. It's just that cniles are moronic like you and don't understand that classes are useful too, just like you don't understand that structs are useful too.
>Structs are USEFUL >How? I mean... They just ARE, OK!?
In C, a struct is just a collection of data fields. It has no member functions and no inheritance, so it's hard to justify calling it a class.
(They also have their own namespace for legacy reasons, so you need to either use the struct keyword each time you refer to them or use a typedef.)
In C++, a struct is just a class whose members are public by default. If a struct or class contains only data fields and no constructors, virtual methods, etc then it's equivalent to a C struct and we call it a "POD type". The struct keyword quirk doesn't apply.
So it is a shit thing that no one would bother looking at, is confusing and you are better off using classes.
structs are just classes with some limitations. unless you're using c++ in which case they're basically the same thing with minor differences
>scoped access
ironically, they had enough brain to make struct names be on a different semantic scope than variables names. You can use static global structs as sort of pseudoscopes too.
structs are useful, moron. It's just that cniles are moronic like you and don't understand that classes are useful too, just like you don't understand that structs are useful too.
In C, a struct is just a collection of data fields. It has no member functions and no inheritance, so it's hard to justify calling it a class.
(They also have their own namespace for legacy reasons, so you need to either use the struct keyword each time you refer to them or use a typedef.)
In C++, a struct is just a class whose members are public by default. If a struct or class contains only data fields and no constructors, virtual methods, etc then it's equivalent to a C struct and we call it a "POD type". The struct keyword quirk doesn't apply.
Yes, you can do it manually by exploiting the fact that casting a pointer to a struct into a pointer to its first member is guaranteed to be valid. And you can roll your own vtables if you want, like COM objects do.
That's different from formal language-level support for inheritance.
Structs can have functions as members.
struct shit {
int (*func)(int ass);
};
A member that is a function is not the same as a "member function" (method).
That's not an example of inheritance. You are casting a pointer to a different struct and that's what gives you then access to the field.
Also you embedded wo struct inside man struct. Are you implying that every man is a little girly inside?
lol no?
It's not his fault. OOP evangelists have poisoned everything and in the process completely forgot what defines OOP.
>he thinks there's a strict definition for OOP
If there was any, good type system would be a minimum requirement, something C will never have.
>>he thinks there's a strict definition for OOP
I made no such claim, because the definition has been shifting throughout time. However, nowadays people tend to think about everything in OOP terms because that's the only paradigm they are familiar with. And that is just stupid. At that point, there is no need to define OOP because it is void of meaning.
>good type system would be a minimum requirement
I disagree but that is beside the point.
ok show me what OOP looks like without a good type system then
no idea, I don't get paid to model inheritance trees
>what OOP looks like without a good type system
C++ comes to mind. Enjoy.
My bad, I forgot that cniles are too mentally ill to understand anything that's not as shit as C, disregard anything I wrote or asked.
Yes, why would you want to use a struct instead of a class? Is just a class but limited.
So class but worse.
>Structs are USEFUL
>How? I mean... They just ARE, OK!?
So it is a shit thing that no one would bother looking at, is confusing and you are better off using classes.
That's what I said. Classes, but shit.
A struct is just a custom data type
ye
they were around before the idea of scoped access was a thing, and in order to stay compatible with c code we still have them
>scoped access
ironically, they had enough brain to make struct names be on a different semantic scope than variables names. You can use static global structs as sort of pseudoscopes too.
yeah scoped access isn't the correct term but you know what i mean
object restricted access maybe
structs are useful, moron. It's just that cniles are moronic like you and don't understand that classes are useful too, just like you don't understand that structs are useful too.
i know what u mean but at the same time i dont lol
why C is so gay it needs second time struct keyword
In C, a struct is just a collection of data fields. It has no member functions and no inheritance, so it's hard to justify calling it a class.
(They also have their own namespace for legacy reasons, so you need to either use the struct keyword each time you refer to them or use a typedef.)
In C++, a struct is just a class whose members are public by default. If a struct or class contains only data fields and no constructors, virtual methods, etc then it's equivalent to a C struct and we call it a "POD type". The struct keyword quirk doesn't apply.
>he thinks C has no inheritance
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
struct wo
{
bool is_a_woman;
};
struct man
{
struct wo woman;
};
int main() {
struct man const male = {0};
struct wo const* const troony = (struct wo const*)♂
assert(troony->is_a_woman);
}
>struct wo const* const troony
god damn c is ugly
Yes, you can do it manually by exploiting the fact that casting a pointer to a struct into a pointer to its first member is guaranteed to be valid. And you can roll your own vtables if you want, like COM objects do.
That's different from formal language-level support for inheritance.
A member that is a function is not the same as a "member function" (method).
That's not an example of inheritance. You are casting a pointer to a different struct and that's what gives you then access to the field.
Also you embedded wo struct inside man struct. Are you implying that every man is a little girly inside?
Structs can have functions as members.
struct shit {
int (*func)(int ass);
};
which has nothing to do with member functions that don't exist in C
If you're only going to use one variable in the struct then you should make it a union to save memory.
thanks anon
and if you're not going to use negative numbers make sure to make it unsigned!
structs are just classes with some limitations. unless you're using c++ in which case they're basically the same thing with minor differences
ehhh sort of, but not really
structs are about data/storage, classes are about behavior
even though they are the same thing in c++ like other anons said