0

I have the following class structures

Category(MustInherit)

The following classes inherits Category

strongPerson
weakPerson

Then I have the class

Job (MustInherit)

The following classes inherits Job

Craft
DeskJob

Now the user can can choose come characteristics and create a Person (in this example a craftsman).

sub start()
    'Person
    dim s as new strongPerson(...)
    dim j as new craft(...)
sub end

My questions:

  1. I used to program procedually and the Sub start() reminds me a lot of it. Is the approach I choose a good one? If not why? Would it be better do use interfaces and build a class Person (using multi inheritance)?
  2. Since there are many more categories and jobs this is going to be quite complex with categories * job posibilities. Doese there exist a recommendable design pattern? The field of design patterns is quite big and I read through a lot but couldnt find an apropriate one.
ruedi
  • 5,365
  • 15
  • 52
  • 88
  • 1
    Take a look at the following discussion about "IS-A" and "HAS-A" concepts. I think it might help you answer your own question. http://stackoverflow.com/questions/2218937/has-a-is-a-terminology-in-object-oriented-language – David Tansey Apr 06 '14 at 16:22
  • How is that sample creating a person? You have two separate objects that are not tied to each other in any way. – paparazzo Apr 06 '14 at 18:28
  • I thought I print the content of these two objects so the user can see the characteristics in a form but didnt see that there are two objects instead of one. I am really new to oop so this my be really suboptimal. – ruedi Apr 06 '14 at 18:31
  • Putting them on the same form is not linking the objects. Is an an astronaut a deskjob or a craft? – paparazzo Apr 06 '14 at 18:52
  • This is a good example for Bridge design pattern http://en.wikipedia.org/wiki/Bridge_pattern – srsyogesh Apr 07 '14 at 15:58

0 Answers0