Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. who can give me a example in C++ using Factory Pattern

who can give me a example in C++ using Factory Pattern

Scheduled Pinned Locked Moved C / C++ / MFC
c++designregexarchitecturetutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    york528
    wrote on last edited by
    #1

    I am learning Design Pattern and who can give me a easy example I write some demo but I think they are not good so I wanna get some good one that can make me understand the pattern better. Thanks a lot!~ ;)

    C L 2 Replies Last reply
    0
    • Y york528

      I am learning Design Pattern and who can give me a easy example I write some demo but I think they are not good so I wanna get some good one that can make me understand the pattern better. Thanks a lot!~ ;)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      This is a meaningless question. Which pattern ? I suggest buying a good book and reading on both patterns, and their examples.

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      Y 1 Reply Last reply
      0
      • Y york528

        I am learning Design Pattern and who can give me a easy example I write some demo but I think they are not good so I wanna get some good one that can make me understand the pattern better. Thanks a lot!~ ;)

        L Offline
        L Offline
        laksh2204
        wrote on last edited by
        #3

        Check this link. I hope this will help you. http://www.codeguru.com/forum/showthread.php?t=327982[^]

        Y 1 Reply Last reply
        0
        • L laksh2204

          Check this link. I hope this will help you. http://www.codeguru.com/forum/showthread.php?t=327982[^]

          Y Offline
          Y Offline
          york528
          wrote on last edited by
          #4

          Thanks i am new with Disign Pattern It's so helpful

          1 Reply Last reply
          0
          • C Christian Graus

            This is a meaningless question. Which pattern ? I suggest buying a good book and reading on both patterns, and their examples.

            Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

            Y Offline
            Y Offline
            york528
            wrote on last edited by
            #5

            One more question

            Product //abstract Creator //abstract
            +Method() +FactoryMethod()
            | |
            | |
            | |
            ConcreteProduct<-------------ConcreteCreator
            +Method() +FactoryMethod()-----return new ConcreteProduct

            In the demo code of Factory Pattern they use return to new a ConcreteProduct object Factory* fac = new ConcreteFactory(); Product* p = fac->CreateProduct(); what about using a member variabal of Creator to control Creator's behavior like: Product* p = new CreateProduct(); //use p to initialize member variable Product* _p; Factory* fac = new ConcreteFactory(p); and use like "fac->_p->method()" to call different subclass member funtion is it good or not to use a abstract class object as member variabal to control its behavior ???:confused:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups