[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.pdt] Re: inheritance, fluent interfaces, and code completion

Michael Spector wrote:
Is setRole() declared as abstract method in your Article class ?

No. I (will) have other classes that are derived from Article that won't have this functionality, so I don't want it in the base class.


I think the only way I could get the code completion working would be to override setTitle() in NewsArticle:

/**
* Set the Title of the Article
*
* @param string $title
* @return NewsArticle
*/
public function setTitle($title = null)
{
 parent::setTitle($title);
}

That'd get old pretty fast, though.

I'm actually starting to wonder if the inheritance would work at all in a more strongly typed language. I don't think Java, for example, would let me get away with the following:

NewsArticle newsArticle = new Article();

I might need to have a rethink this one. Maybe it's fluent OR inheritance, but not both.

Thanks for your input.

G.