This Interview: Structs in C++ - You asked the candidate if a function can be defined in a struct. - The candidate said that structs are only used for pure data. - You corrected him by saying that functions can be defined in a struct, but they are typically used for pure data. - This means you acknowledged both what is possible and what is common practice. Another Interview: Stack Data Structure in C++ - You asked the candidate, where is a Stack data structure stored? - The candidate said that a Stack data structure can be stored in either Stack memory or Heap memory. - You responded by saying that a Stack data structure is stored only in Stack memory. - The candidate's answer is correct. A Stack data structure is possible to be stored in Stack memory or Heap memory. However, you asserted that a Stack data structure is only stored in Stack memory. Your responses are inconsistent, in the first case, you allowed for both possibilities (what is possible vs. what is typical), but in the second case, you dismissed one possibility entirely.
Struct members are public by default, while class members are private by default other than that they are functionally the same.
Memory allocations: Structs are allocated on the stack, whereas classes are allocated on the heap. OOP characteristics: Structs cannot perform inheritance based operations whereas classes can do that Performance: Structs are faster in terms of memory allocation/deallocation speeds and execution, but limited in memory scope, due to the stack size limitations.
Depends on the language. Would like to see you define a function in a C struct, and obviously it cannot be a pointer to a function, since that isnt what is meant by the question asked in the video
saying you should consider a new career if you don't know this is just bad ragebait, do better man
In C++ struct members are public by default while in a class the members are private by default. In pure C (not C++) structs are only an aggregated data type, a collection of data items and doesn't support function declarations, however you can declare function pointers inside structs to kinda simulate this. So saying that "you still define functions inside a struct" in C++ Yes, in pure C No.
indeed quite weird that c++ hv struct and class to confuse people
struct is a value type while class is a reference type (C#)
I used to like this fool then for some reason after he got his new job his arrogance and ego has gone through the roof. Unsubscribing.
iirc struct is an aggregate but class is not
bros cooked
Structs default to public, classes default to private
Access modifiers and inheritance
Sayid from Lost lookin ahhh., Other dude Anthony Davis lookin ahhhh
BAIT
@avneet12284