3

Simply explain class and objects without examples

Comments
  • 2
    without *any* examples? hmm... well it wont be understandable by a child but

    classes are extendable data structures with integrated functionality that operates on top of the data they define

    objects are in-memory instances of classes

    interesting question, I'll give that some more thought in my next shower
  • 1
    @Hazarth Great. I have been using examples when talking about classes and objects in my entire career. I also learned like that. So I was wondering what devs around here got to say about this
  • 7
    Classes are blueprints for objects. Objects are implementations of those blueprints, stored in heap.

    Classes define object's structure, constant values, functions. Objects cannot have any additional properties, not defined by the classes they are made by. Objects are sort of copies of their classes, filled with dynamic data.

    Classes define interactions between objects. Objects interact as defined by classes
  • 2
    @netikras ...unless you're in Salesforce land, in which case classes are just something that's always written in Apex, objects are the equivalent of custom database tables, instances of Apex classes don't even have a name =)
  • 1
    I usually explain it very similarly to @netikras . With examples, of course.
  • 1
    Classes are groups of objects.
    Objects are things that do stuff.
  • 0
    @mundo03 Classes aren't really groups of objects. That sounds much more like a description of a collection.
  • 0
    @AlmondSauce a collection is a data type that can in fact hold objects, and even classes.

    But in language agnostic OOP, classes are templates to create objects, maybe I made it too simple.
Add Comment