[Prévia] [Próxima] [Prévia por assunto] [Próxima por assunto]
[Índice cronológico]
[Índice de assunto]
Re: consertando a confusão na definição de subtipos
- Subject: Re: consertando a confusão na definição de subtipos
- From: Helves Domingues <helves*domingues:org>
- Date: Mon, 5 Sep 2005 23:24:08 -0300
Fabio,
A definição :
In object oriented programming, this means that objects of type S
must accept every message <http://computing-
dictionary.thefreedictionary.com/message> that one of type T would.
não é parecida com subclasse? (Considerando S subclasse da classe T)
Achei a seguinte página :
http://undergraduate.csse.uwa.edu.au/units/230.224/timBudd/chap10/
chap10.html
que explora um pouco as diferença entre subtipo e subclasse. Acho que
esta página
pode complementar a definição. Concorda?
Abraços,
Helves
Em 05/09/2005, às 15:41, Fabio Kon escreveu:
Oi,
Eu havia me esquecido disso mas os ares da semana da pátria me
lembraram. Logo na primeira aula da disciplina eu dei uma visão
geral sobre conceitos básicos de OO e falei um pouco sobre subtipos
e supertipos. Um pouco depois, um aluno me alertou que a definição
que eu apresentei oralmente na aula estava meio ao contrário.
Então, vamos esclarecer isso. Peguei o seguinte trecho de http://
computing-dictionary.thefreedictionary.com/subtype:
subtype - If S is a subtype of T then an expression of type S may
be used anywhere that one of type T can and an implicit type
conversion will be applied to convert it to type T.
In object oriented programming, this means that objects of type S
must accept every message <http://computing-
dictionary.thefreedictionary.com/message> that one of type T would.
Portanto, a interface do subtipo é um super-conjunto da interface
do super-tipo. Foi aí que eu me confundi invertendo as coisas.
Feliz semana do saco cheio da pátria,
fabio.