Re: Template method pattern in Java ???
From: Robert C. Martin (unclebob_at_objectmentor.com)
Date: 02/17/04
- Next message: Joe \: "Re: Dijkstra gets it wrong [was: Re: D gets it right]"
- Previous message: TLOlczyk: "Re: Dijkstra gets it wrong [was: Re: D gets it right]"
- In reply to: David Roden: "Re: Template method pattern in Java ???"
- Next in thread: David Roden: "Re: Template method pattern in Java ???"
- Reply: David Roden: "Re: Template method pattern in Java ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 16 Feb 2004 22:30:16 -0600
On Mon, 16 Feb 2004 14:49:52 +0100, David Roden
<d.roden@cytainment.de> wrote:
>Robert C. Martin wrote:
>
>> [...] I like being able to declare a private pure
>> virtual function. What is says to me is that nobody but the base
>> should call it.
>
>Then why do you want to declare it in an interface?
Not an interface, an abstract class.
class Application {
public:
void Run() {
Init();
while (!done)
Idle();
Cleanup();
}
protected:
bool done;
private:
virtual void Init() = 0;
virtual void Idle() = 0;
virtual void Cleanup() = 0;
};
- Next message: Joe \: "Re: Dijkstra gets it wrong [was: Re: D gets it right]"
- Previous message: TLOlczyk: "Re: Dijkstra gets it wrong [was: Re: D gets it right]"
- In reply to: David Roden: "Re: Template method pattern in Java ???"
- Next in thread: David Roden: "Re: Template method pattern in Java ???"
- Reply: David Roden: "Re: Template method pattern in Java ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|