470,815 Members | 1,277 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

A sample program to implement a factory design pattern

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

Dec 6 '06 #1
7 4170
"sunny" <ka***************@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
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.
Dec 6 '06 #2
Yes, everyone should do his homework by himself.
"Jim Langston Ğ´µÀ£º
"
"sunny" <ka***************@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
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.
Dec 6 '06 #3
do****@gmail.com wrote:
Yes, everyone should do his homework by himself.
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.html>
Dec 6 '06 #4

Jim Langston wrote in message ...
>"sunny" <ka***************@gmail.comwrote in message ...
>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.
Speak for yourself, Jim! I'll do it for $300.us a kloc (not in my compact
format.).
<G>
--
Bob R
POVrookie
Dec 6 '06 #5
IR
BobR wrote:
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,
--
IR
Dec 6 '06 #6

IR wrote in message ...
>BobR wrote:
>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! ]
--
Bob R
POVrookie
Dec 6 '06 #7
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.

Dec 7 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by max | last post: by
1 post views Thread by David Bellot | last post: by
4 posts views Thread by Pallav singh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.