A sample program to implement a factory design pattern

S

sunny

Hai,

can anyone implemen this problem.I am unable to implement.i tried but i
am going out of the design pattern.

Implement the Factory Design Pattern for the following scenario:
Base class = Quad
Derived classes = Square, Rectangle
Take command line arguments for length & width. Depending upon no. of
arguments,
create and return the object of appropriate derived class. Each class
should have a
function named "desc" to print the class name. Base class should be
abstract.

Kindly find me the solution for this problem

Thanking You,
K.RajaSekhar
 
J

Jim Langston

sunny said:
Hai,

can anyone implemen this problem.I am unable to implement.i tried but i
am going out of the design pattern.

Implement the Factory Design Pattern for the following scenario:
Base class = Quad
Derived classes = Square, Rectangle
Take command line arguments for length & width. Depending upon no. of
arguments,
create and return the object of appropriate derived class. Each class
should have a
function named "desc" to print the class name. Base class should be
abstract.

Kindly find me the solution for this problem

Thanking You,
K.RajaSekhar

Sorry, we won't do your homework for you. And repeating the same quesiton 3
times isnt' going to help.

Show us what you've tried that didnt work. Show us code.
 
B

BobR

Jim Langston wrote in message ...
Sorry, we won't do your homework for you.

Speak for yourself, Jim! I'll do it for $300.us a kloc (not in my compact
format.).
<G>
 
I

IR

BobR said:
Jim Langston wrote in message ... [...]
Sorry, we won't do your homework for you.

Speak for yourself, Jim! I'll do it for $300.us a kloc (not in my
compact format.).

$300/kloc is cheap. I'd call that disloyal competition! :p


Cheers,
 
B

BobR

IR wrote in message ...
BobR said:
Jim Langston wrote in message ... [...]
Sorry, we won't do your homework for you.

Speak for yourself, Jim! I'll do it for $300.us a kloc (not in my
compact format.).

$300/kloc is cheap. I'd call that disloyal competition! :p

I count the lines in the included system headers!! <G>

#include <iostream>
#include <ostream>
#include <string>

int main(){
std::cout<<std::string("Hello Student\n");
std::cout<<"You owe me $300.us!"<<std::endl;
return 0;
}

I need the bucks!
[ government: move decimal point one or two places to right!
I want some of that porkbarrel $s! ]
 
R

RKS

can anyone implemen this problem.I am unable to implement.i tried but i
am going out of the design pattern.

Why dont you show the code that you have tried. Someone may be able to
help you.
Implement the Factory Design Pattern for the following scenario:
Base class = Quad
Derived classes = Square, Rectangle
Take command line arguments for length & width. Depending upon no. of
arguments,
create and return the object of appropriate derived class. Each class
should have a
function named "desc" to print the class name. Base class should be
abstract.

Just type "Design patterns using C++" in Google and see the number of
links you get. I think the very first one is good enough.
Kindly find me the solution for this problem

You have work out the solution. You can only ask assistance if you run
in to problems. No one is going to do your homework.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top