Window Classroom

Aherana allows to create a new type of object – a new classroom – to apartir of another one already existing. The new classroom keeps osatributos and the functionality of the classroom of which drift; therefore, we say that it ' ' herda' ' the characteristics of that classroom. To mesmotempo, it can receive attributes and functions special not encontradosna original classroom. Coming back to the example of the one window programWindows, this type of object could call Window. When creating umtipo of object to function as box of special comatributos dialogue is a window, as the exhibition of buttons and options.

Onovo type could call JanelDilogo and would inherit caractersticasda classroom Window, also receiving the exclusive attributes from one caixade dialogue. One of the advantages of the inheritance is the easiness of localizarerros of programming. For example, case an object derived from outroapresente an error of functioning; if the original object funcionavacorretamente, is clearly that the error is in the part of the code that implementaas new characteristics of the derived object. The inheritance allows, also, to reaproveitar the written code previously, adaptando it the novasnecessidades. This is very important because the costs dedesenvolvimento of software are many raising. Hand-of-obraaltamente specialized she is expensive; the process is delayed and subject unexpected aocorrncias. Polimorfismo Polimorfismorefere it the two more object or capacity to answer to the mesmamensagem, each one its proper way.

The use of the inheritance becomes-sefcil with the polimorfismo. Since that mtodocom is not necessary to write one different name to answer to each message, the code is maisfcil to understand. For example, without polimorfismo, to insert novoempregado, the following code would be necessary: Colaborador1.InsereColaborador Gerente1.InsereGerente Presidente1.InserePresidente In this in case that, Colaborador1, Gerente1 and Presidente1 they are objects dasrespectivamente of the classrooms Collaborating, Controlling and President. With opolimorfismo, tipode is not necessary to have a different method for each object.