-5
I started studying object orientation and I need some help. I don’t understand the question Could anyone help me.
With the Client and Person classes: a. create a client instance b. create a person instance c. create an Arraylist of Clients d. add the client instance created in (a) in Arraylist. e. add the person instance created in (b) in Arraylist.
Don’t you understand the statement? From what is described, it seems that you have to create a class
Pessoa
, a classCliente
extending Person (implicit), creating an instance of Person, an instance of Client, an instance ofArrayList
which will store both the person and the client, and then add them to the list. As Client Extends Person, you can declare your Arraylist asArrayList<Pessoa>
, thus when recovering an existing object in it, you will be assured that the object will possess the attributes and methods of Person.– Andre