Click here to Skip to main content
15,911,035 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
AnswerRe: Microsoft Application Architecture Guide Pin
Eddy Vluggen8-Jul-11 13:19
professionalEddy Vluggen8-Jul-11 13:19 
GeneralRe: Microsoft Application Architecture Guide Pin
V.9-Jul-11 22:33
professionalV.9-Jul-11 22:33 
GeneralRe: Microsoft Application Architecture Guide Pin
GenJerDan3-Aug-11 6:13
GenJerDan3-Aug-11 6:13 
GeneralRe: Microsoft Application Architecture Guide Pin
V.3-Aug-11 19:54
professionalV.3-Aug-11 19:54 
QuestionData Fusion Pin
TorstenH.18-May-11 3:44
TorstenH.18-May-11 3:44 
AnswerRe: Data Fusion Pin
thatraja11-Jun-11 14:31
professionalthatraja11-Jun-11 14:31 
GeneralRe: Data Fusion Pin
TorstenH.13-Jun-11 21:06
TorstenH.13-Jun-11 21:06 
QuestionAbstract factory Pin
Phil00515-May-11 1:37
Phil00515-May-11 1:37 
Hi! Can somebody explain to me why we use a Base interface as a return type in a Factory interface?
Second question in concerned with the code in Main.
I figured out that Factory factory = new ConcreteFactory2() is a reference to the implementation of a ConcreteFactory2 of GetObject() method. What is the next line?


Thanks. I appreciate your help!

abstractfactory
{

class Program
{

static void Main(string[] args)
{

Factory factory = new ConcreteFactory2();
Base obj = factory.GetObject();
obj.DoIt();

}

}

}

interface Factory
{

Base GetObject();

}


class ConcreteFactory1 :Factory
{

public Base GetObject()
{

return new Derived1(); // do we return an instance of derived 1 interface?
}

}


class ConcreteFactory2 : Factory
{

public Base GetObject()
{

return new Derived2();
}

}


interface Base
{

void DoIt();
}

class Derived1 : Base
{

public void DoIt()
{

Console .WriteLine("Derived 1 method");
}

}

class Derived2 : Base
{

public void DoIt()
{

Console.WriteLine("Derived 2 method");
}

}
AnswerRe: Abstract factory Pin
Phil00516-May-11 23:58
Phil00516-May-11 23:58 
AnswerRe: Abstract factory PinPopular
David Skelly17-May-11 2:14
David Skelly17-May-11 2:14 
GeneralRe: Abstract factory Pin
Richard MacCutchan17-May-11 2:36
mveRichard MacCutchan17-May-11 2:36 
GeneralRe: Abstract factory Pin
Phil00517-May-11 3:06
Phil00517-May-11 3:06 
GeneralRe: Abstract factory Pin
Shameel17-May-11 4:21
professionalShameel17-May-11 4:21 
GeneralRe: Abstract factory Pin
Phil00520-May-11 22:09
Phil00520-May-11 22:09 
QuestionUML state diagrams Pin
Phil00510-May-11 7:39
Phil00510-May-11 7:39 
AnswerRe: UML state diagrams Pin
Gerben Jongerius10-May-11 21:19
Gerben Jongerius10-May-11 21:19 
GeneralRe: UML state diagrams Pin
Phil00515-May-11 1:22
Phil00515-May-11 1:22 
AnswerRe: UML state diagrams Pin
Keld Ølykke24-May-11 3:16
Keld Ølykke24-May-11 3:16 
GeneralRe: UML state diagrams Pin
Phil00527-May-11 1:04
Phil00527-May-11 1:04 
QuestionStored Procedures Pin
Leslie Sanford9-May-11 17:38
Leslie Sanford9-May-11 17:38 
AnswerRe: Stored Procedures Pin
Gerben Jongerius10-May-11 21:27
Gerben Jongerius10-May-11 21:27 
AnswerRe: Stored Procedures Pin
jschell24-May-11 8:43
jschell24-May-11 8:43 
QuestionThinking about the Future Pin
John D. Sanders6-May-11 8:53
John D. Sanders6-May-11 8:53 
AnswerRe: Thinking about the Future Pin
Pete O'Hanlon6-May-11 9:26
mvePete O'Hanlon6-May-11 9:26 
GeneralRe: Thinking about the Future Pin
Sandeep Mewara6-May-11 17:41
mveSandeep Mewara6-May-11 17:41 

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.