Need Help designing my Application - Inheritance versus Composition
I would like to keep this one short. I build a HouseA that has two rooms say "BedRoom" and "studyRoom" both derives from a base Class called "room".
BedRoom and StudyRoom have a same parent called "House". Also any room in a house can access any other rooms only through the parent. If BedRoom has to access any attribute of StudyRoom, it has to go only Via House (i.e Parent) and vice-versa.
 
    HouseA ISA House
    HouseA HAS BedRoom and StudyRoom.
    BedRoom ISA Room
    StudyRoom ISA Room

Now the Problem. Let's say, I build another home(say HouseB), which is a exactly the same  as the above,but with one change. I don't want two seperate rooms (i.e BedRoom and StudyRoom) instead a single room (MasterRoom) which has both these facilities. 
For the sake of code reusablility, I could think of the following Design Options.

    Option-1:
    HouseB ISA House
    HouseB Has MasterRoom
    MasterRoom ISA Room

Here I loose the ability to reuse the attributes of BedRoom and StudyRoom that I created for HouseA. Note most of the attributes of BedRoom and StudyRoom needs to reimplemented in MasterRoom anyway thereby resulting in Code Duplication.

    Option-2:
    HouseB ISA House
    HouseB Has MasterRoom
    MasterRoom ISA Room
    MasterRoom HAS LogicalBedroom
    MasterRoom HAS LogicalStoreRoom
    LogicalBedroom ISA Bedroom
    LogicalStoreRoom ISA Storeroom

This way, I use composition so that I could reuse most of my code ( I have severalK lines of code that I could reuse).But the problem is BedRoom is a concrete class and logicalBedRoom may find certain attributes not suitable and may be forced to override  methods so that 
it does nothing. For example, Bedroom->noOfSides() = 4 and logicalBedRoom->noOfSides() = ??. Is this a good Inheritance ?

My actual design is for a complex Chip that combines the functionality of two individual Chips ( I used House(motherboard) and Room (Chip) analogy). I code in Object Oriented Perl and I would really appreciate any alternate design suggestions.

Thanks

Need Help designing my Application - Inheritance versus Composition
===

I would like to keep this one short. I build a HouseA that has two rooms say "BedRoom" and "studyRoom" both derives from a base Class called "room".
BedRoom and StudyRoom have a same parent called "House". Also any room in a house can access any other rooms only through the parent. If BedRoom has to access any attribute of StudyRoom, it has to go only Via House (i.e Parent) and vice-versa.
 
    HouseA ISA House
    HouseA HAS BedRoom and StudyRoom.
    BedRoom ISA Room
    StudyRoom ISA Room

Now the Problem. Let's say, I build another home(say HouseB), which is a exactly the same  as the above,but with one change. I don't want two seperate rooms (i.e BedRoom and StudyRoom) instead a single room (MasterRoom) which has both these facilities. 
For the sake of code reusablility, I could think of the following Design Options.

    Option-1:
    HouseB ISA House
    HouseB Has MasterRoom
    MasterRoom ISA Room

Here I loose the ability to reuse the attributes of BedRoom and StudyRoom that I created for HouseA. Note most of the attributes of BedRoom and StudyRoom needs to reimplemented in MasterRoom anyway thereby resulting in Code Duplication.

    Option-2:
    HouseB ISA House
    HouseB Has MasterRoom
    MasterRoom ISA Room
    MasterRoom HAS LogicalBedroom
    MasterRoom HAS LogicalStoreRoom
    LogicalBedroom ISA Bedroom
    LogicalStoreRoom ISA Storeroom

This way, I use composition so that I could reuse most of my code ( I have severalK lines of code that I could reuse).But the problem is BedRoom is a concrete class and logicalBedRoom may find certain attributes not suitable and may be forced to override  methods so that 
it does nothing. For example, Bedroom->noOfSides() = 4 and logicalBedRoom->noOfSides() = ??. Is this a good Inheritance ?

My actual design is for a complex Chip that combines the functionality of two individual Chips ( I used House(motherboard) and Room (Chip) analogy). I code in Object Oriented Perl and I would really appreciate any alternate design suggestions.

Thanks
