Trouble understanding Object State, Behavior, and Identity?

前端 未结 5 1235
面向向阳花
面向向阳花 2021-01-30 11:42

I have been instructed by my professor to introduce myself on a page as if I were an object, and that I must address three things:
1) Object State, 2) Behavior, and 3) Ident

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 12:18

    State:- state is values of objects variables

    Behavior:- are methods of object

    Identity:- It is name of object.

    e.g:-

    class car{

    int speed = 100;

    void accelerate(){ }

    }

    class_car obj_car;

    here,

    State:- speed

    Behavior:- accelerate

    Identity:- obj_car

提交回复
热议问题