## Tcl9.0.3/Tk9.0.3 Documentation > Tcl Commands > abstract

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

oo::abstract — そのものの直接の具現値を許容しない級 A class that does not allow direct instances of itself

### 構文 SYNOPSIS

package require tcl::oo
oo::abstract method ?arg ...?

### 級の階層構造 CLASS HIERARCHY

oo::object
→ oo::class
→ oo::abstract

### 説明 DESCRIPTION

要約級は定義を含むことができる級であるが､直接には生成されない; それらは凡そ単に継承され､又､間接的に生成されるだけと意図されている｡ oo::class (create と new) の特徴的な手段は oo::abstractの具現値によって移送はされない｡ Abstract classes are classes that can contain definitions, but which cannot be directly manufactured; they are intended to only ever be inherited from and instantiated indirectly. The characteristic methods of oo::class (create and new) are not exported by an instance of oo::abstract.

註意すべきは､ oo::abstract はそれそのものは oo::abstract の具現値ではない｡ Note that oo::abstract is not itself an instance of oo::abstract.

#### 構成子 CONSTRUCTOR

oo::abstract 級は明示的に構成子を定義しない; この意味は oo::class 級の構成子と効果的に同じであることを意味する｡ The oo::abstract class does not define an explicit constructor; this means that it is effectively the same as the constructor of the oo::class class.

#### 破壊子 DESTRUCTOR

oo::abstract 級は明示的に破壊子を定義しない; その具現値の破壊は通常の級の破壊と似ている(更にその全ての副級を破壊することになる)｡ The oo::abstract class does not define an explicit destructor; destroying an instance of it is just like destroying an ordinary class (and will destroy all its subclasses).

#### 移送された手段 EXPORTED METHODS

oo::abstract 級は新しく移送される手段は全く定義しない｡ The oo::abstract class defines no new exported methods.

#### 非移送手段 NON-EXPORTED METHODS

oo::abstract 級は create と createWithNamespace と new は移送されないと明示的に宣言する｡ The oo::abstract class explicitly states that create, createWithNamespace, and new are unexported.

### 用例 EXAMPLES

この実施例は単純な級階層構造を定義し､その新しい具現値を創生する｡次に階層構造を破壊する前に､対象の手段を起動し､階層構造を破壊し破壊は推移的であることを指し示す｡ This example defines a simple class hierarchy and creates a new instance of it. It then invokes a method of the object before destroying the hierarchy and showing that the destruction is transitive.

    oo::abstract create fruit {
        method eat {} {
            puts "yummy!"
        }
    }
    oo::class create banana {
        superclass fruit
        method peel {} {
            puts "skin now off"
        }
    }
    set b [banana new]
    $b peel              → prints 'skin now off'
    $b eat               → prints 'yummy!'
    set f [fruit new]    → error 'unknown method "new"...'

### SEE ALSO

oo::define, oo::object

### KEYWORDS

abstract class, class, metaclass, object
Copyright © 2018 Donal K. Fellows