lundi 31 octobre 2016

Use empty class(java)

I m doing my best to speak in english to you, sorry for mistakes.

I have a school project about walmart's software.

My walmart has different sectors(food,technology,hygiene etc) and, products have also sectors ( an orange is food, a cd-rom is technology etc).

So i m going to create an abstract class sectors .and food , technology ,hygiene etc, will extends sectors.

BUT all their classes are empty: no field and methods, only extends stuff. So i m wondering if i should do it like that or this is awful.

Indeed i need, for example, a walmart that sell only food and technology, to know the products that are food or technology.

public class walmart{
set<sector> sectors //can be for example only food, only technology or both
//field and methods
}

public class product{
sector type
//field and methods
}
public abstract class sectors{//almost empty
}
public abstract class food extends sectors{//also empty
}
public abstract class technology extends sectors{//still empty}

Thanks

Aucun commentaire:

Enregistrer un commentaire