Click here to Skip to main content
15,913,758 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionHow do you design this ? Pin
Eytukan18-Dec-12 2:33
Eytukan18-Dec-12 2:33 
An object called MovableObject can move through different methods.
MoveByLegs, wheels & Wings. When we choose one method, i.e MoveByLegs and pass Legs arguments, the other two will be unused.


Should I design it like this:
C++
enum MoveType
{
MoveByLegs,
MoveByWheels,
MoveByWings
}

class MovableObject
{
List<leg> lstLegs;
List<Wheels> lstWheels;
List<Wing> lstWings;

MoveType m_Movetype;

EnableMovement(MoveType movetype_in, object obj_in)
{
m_Movetype = movetype_in;
switch (movetype_in)
{
case MoveByLegs:
lstLegs = List<Leg>(obj_in);
break;

case MoveByWheels:
lstWheels = List<Wheel>(obj_in);
break;

case MoveByWings:
lstWings = List<Wing>(obj_in);
break;
}

}

Move()
{
if(m_Movetype == MoveType.MoveByLegs)
{

//  Process lstLegs
}
similar case for MoveByWheels & Legs

}
}


Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.

AnswerRe: How do you design this ? Pin
Pete O'Hanlon18-Dec-12 2:47
mvePete O'Hanlon18-Dec-12 2:47 
GeneralRe: How do you design this ? Pin
Eytukan18-Dec-12 2:54
Eytukan18-Dec-12 2:54 
GeneralRe: How do you design this ? Pin
Pete O'Hanlon18-Dec-12 3:02
mvePete O'Hanlon18-Dec-12 3:02 
GeneralRe: How do you design this ? Pin
Lampridis Vasilis30-Dec-12 0:04
Lampridis Vasilis30-Dec-12 0:04 
GeneralRe: How do you design this ? Pin
Eytukan30-Dec-12 18:00
Eytukan30-Dec-12 18:00 
AnswerRe: How do you design this ? Pin
jschell18-Dec-12 8:14
jschell18-Dec-12 8:14 
GeneralPlease hold on Pin
Eytukan18-Dec-12 18:59
Eytukan18-Dec-12 18:59 
GeneralRe: How do you design this ? Pin
Eytukan30-Dec-12 17:59
Eytukan30-Dec-12 17:59 
GeneralRe: How do you design this ? Pin
jschell31-Dec-12 9:12
jschell31-Dec-12 9:12 
Questionportability/deployment Pin
Member 838594911-Dec-12 4:39
Member 838594911-Dec-12 4:39 
AnswerRe: portability/deployment Pin
jschell11-Dec-12 10:07
jschell11-Dec-12 10:07 
AnswerRe: portability/deployment Pin
Mycroft Holmes16-Dec-12 11:59
professionalMycroft Holmes16-Dec-12 11:59 
GeneralRe: portability/deployment Pin
jschell17-Dec-12 8:40
jschell17-Dec-12 8:40 
Question.NET vs WINRT on Windows 8 Pin
devvvy9-Dec-12 15:13
devvvy9-Dec-12 15:13 
AnswerRe: .NET vs WINRT on Windows 8 Pin
Richard MacCutchan9-Dec-12 22:12
mveRichard MacCutchan9-Dec-12 22:12 
GeneralRe: .NET vs WINRT on Windows 8 Pin
devvvy10-Dec-12 2:52
devvvy10-Dec-12 2:52 
AnswerRe: .NET vs WINRT on Windows 8 Pin
Eddy Vluggen9-Dec-12 22:42
professionalEddy Vluggen9-Dec-12 22:42 
GeneralRe: .NET vs WINRT on Windows 8 Pin
devvvy10-Dec-12 2:53
devvvy10-Dec-12 2:53 
GeneralRe: .NET vs WINRT on Windows 8 Pin
Eddy Vluggen10-Dec-12 3:05
professionalEddy Vluggen10-Dec-12 3:05 
GeneralRe: .NET vs WINRT on Windows 8 Pin
devvvy10-Dec-12 3:08
devvvy10-Dec-12 3:08 
GeneralRe: .NET vs WINRT on Windows 8 Pin
Eddy Vluggen10-Dec-12 3:11
professionalEddy Vluggen10-Dec-12 3:11 
AnswerRe: .NET vs WINRT on Windows 8 Pin
Robb Ryniak10-Dec-12 2:14
Robb Ryniak10-Dec-12 2:14 
GeneralRe: .NET vs WINRT on Windows 8 Pin
devvvy10-Dec-12 3:04
devvvy10-Dec-12 3:04 
GeneralRe: .NET vs WINRT on Windows 8 Pin
Robb Ryniak10-Dec-12 5:13
Robb Ryniak10-Dec-12 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.