using database and inheritance