def to class