'
'---------------------------------
'SIMPLE CLASSES
'=================================

 'The methods are defined outside the class block.
 '
  '-------------
  class cuboid
  '=============

  method surface() as double
  method volume() as double
  method setsize(l as double,w as double, h as double)
  '
  protected
  height as double
  width  as double
  length as double

  end class

  methods of cuboid
  '================

  method surface() as double
    return (length*width+length*height+width*height)*2
  end method

  method volume() as double
    return length*width*height
  end method

  method setsize(l as double,w as double, h as double)
    length=l : width=w : height=h
  end method

  end methods


  cuboid cu
  cu.setsize 10,5,2

  print "Volume:" tab cu.volume() cr "Surface:" tab cu.surface()
  
  
  '----------
  class brick
  '==========

  has cuboid 'dimensions and also ..
  method setmaterial(m as string)
  method weight() as double
  '
  protected
 density as double
  material as string

  end class
  
  methods of brick
  '===============

  method setmaterial(m as string)
    material=m
    density=1
    if m="ceramic" then density=2
    if m="concrete" then density=2.5
    if m="ice" then density=0.95
  end method

  method weight() as double
    return volume()*density
  end method

  end methods



  brick br
  br.SetMaterial "concrete"
  br.SetSize 20,10,7.5

  print "Brick weight: " br.weight


    
    
