Can you have an object without a class?
Last updated
In class-based languages (Java, C++, C#), no: every object is an instance of some class, even an anonymous one.
In prototype-based languages like JavaScript, yes: objects come from other objects or literals (
{}), andclassis sugar over prototypes.An object (identity + state + behavior) doesn't require a class. Classes are just one common way to produce objects.
- https://www.reddit.com/r/developersIndia/comments/1ktgmfk/software_development_interview_preparation/
- https://www.reddit.com/r/programming/comments/1m2ff3j/casey_muratori_the_big_oops_anatomy_of_a/
- https://www.reddit.com/r/SoftwareEngineering/comments/1ijqgpb/is_the_o_in_solid_still_relevant_or_just_a_relic/
- https://www.reddit.com/r/NorthropGrumman/comments/1bt1ug3/monthly_employmentcorporate_questions_and/