Updated 2015-01-24 15:58:18 by dkf

A derived class is a class based on another class but extended by some new facilities - either more variables or more methods.

The method "object isa" tests whether a specific object is derived from a class. Returns a boolean. Example - create 2 classes, one derived from the other:
  package require Itcl
  itcl::class helloworld {
    public variable owner "No-one"

    method greet {} { puts "Hello World from $owner" }
  itcl::class goodbyeworld {
    inherit helloworld

    method greet {} { puts "Goodbye Cruel World from $owner" }
  helloworld  h1
  goodbyeworld h2
  h1 configure -owner Me
  h2 configure -owner You
  h1 greet
  h2 greet

Here goodbyeworld objects inherit everything that helloworld does, but replaces the greet method with a different message. The following reports that both h1 and h2 are derived from helloworld.
  puts "helloworld h1 [h1 isa helloworld] h2 [h2 isa helloworld]" 

while this snippet shows that h1 is not derived from goodbyeworld, but h2 is.
  puts "Goodbyeworld: h1 [h1 isa goodbyeworld] h2 [h2 isa goodbyeworld]"