Search code examples
language-agnosticprogramming-languages

How do you describe new to a new CS student?


In OOP, there are entities (e.g. Person) which has attributes (e.g. name, address, etc) and it has methods. How do you describe new? Is it a method or just special token to bring an abstract entity to real one?


Solution

  • Depending on the language new is a keyword which can be used as an operator or as a modifier. For instance in C# new can be used:

    • new operator - used to create objects on the heap and invoke constructors.
    • new modifier - used to hide an inherited member from a base class member

    For brand new students I would describe new only as a keyword and leave the modifier out of the discussion. I describe classes as blueprints and new as the mechanism by which those blueprints turn into something tangible - objects.

    You may want to checkout my question: How to teach object oriented programming to procedural programmers for other great answers on teaching OOP to new developers.