Re: OOP real life example (was Re: Why is MySQL more
Oliver Elphick <olly@lfix.co.uk>
From: Oliver Elphick <olly@lfix.co.uk>
To: Greg Copeland <greg@CopelandConsulting.Net>
Cc: Hannu Krosing <hannu@tm.ee>, Curt Sampson <cjs@cynic.net>, Don Baccus <dhogaza@pacifier.com>, PostgresSQL Hackers Mailing List <pgsql-hackers@postgresql.org>
Date: 2002-08-12T15:39:42Z
Lists: pgsql-hackers
On Mon, 2002-08-12 at 15:00, Greg Copeland wrote:
...
> Look a little deeper here. In other OO implementations, I can define a
> class (say class a) which has no instances (abstract base class).
> Furthermore, I can take this case and use it for building blocks
> (assuming multiple inheritance is allowed in this world) by combining
> with other classes (z inherits from a, b, c; whereby classes a, b, c
> still do not have an actual instance). I can create an instance of my
> newly inherited class (z).
>
> Seems to me that there is some distinction between types (classes) and
> and type instances (instance of a specific class) as it pertains to it's
> usability.
>
> How exactly would you create an abstract base class for table type?
CREATE TABLE abstract_base (
cols ...,
CONSTRAINT "No data allowed in table abstract_base!" CHECK (1 = 0)
)
This assumes that the constraint is not inherited or can be removed in
child tables.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And he spake a parable unto them to this end, that men
ought always to pray, and not to faint."
Luke 18:1