applied inheritance to encoding classes