What's the best way to define the words “class” and “object” to someone who hasn't used them?

前端 未结 29 817
情话喂你
情话喂你 2020-12-13 05:11

My neighbor is taking \"Intro to Java\", and asked me to help explain a few of the first-day concepts. I realized that since I do this everyday, I don\'t have the beginner\

29条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 05:54

    Object is an instance of a class Variable is an instance of a type

    That given,a class can be something like "type on steroids": it can have : variables which can be from any type or objects from another class methods,which can operate on class variables in the same way as different types have their methods(for example +(bool,bool)) can have access to the class variables and it's all defined by yourself!

    You can use the classes to model a problem in the optimal way. But there are sometimes other ways to do it ;)(not only OOP)

提交回复
热议问题