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. Overriding problem

Overriding problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 4 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.
  • N Offline
    N Offline
    NoviceEx
    wrote on last edited by
    #1

    There is Base class A which has child's B, C, D, ... Z. I need to add some methods to Z as virtual ones so that they will be overridden in Z child classes Z1, Z2, .. Zn. Is it possible, how can I do it. Note: I cannot add to base class A.

    Richard Andrew x64R CPalliniC 2 Replies Last reply
    0
    • N NoviceEx

      There is Base class A which has child's B, C, D, ... Z. I need to add some methods to Z as virtual ones so that they will be overridden in Z child classes Z1, Z2, .. Zn. Is it possible, how can I do it. Note: I cannot add to base class A.

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      Start by telling us why you need to add the virtual methods. And why you can't add to the base class A.

      The difficult we do right away... ...the impossible takes slightly longer.

      N 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        Start by telling us why you need to add the virtual methods. And why you can't add to the base class A.

        The difficult we do right away... ...the impossible takes slightly longer.

        N Offline
        N Offline
        NoviceEx
        wrote on last edited by
        #3

        Well I have over 50 classes there. All of them have base class the same. Those functions (about 20 functions) are needed only for my one 5 level class (Class A5 : public A4) and two 6 level child classes ( Class A61 : public A5 and Class A62 : public A5). Reason because I want to make one handler class which will use A5 class virtual functions and will handle A61 and A62.

        1 Reply Last reply
        0
        • N NoviceEx

          There is Base class A which has child's B, C, D, ... Z. I need to add some methods to Z as virtual ones so that they will be overridden in Z child classes Z1, Z2, .. Zn. Is it possible, how can I do it. Note: I cannot add to base class A.

          CPalliniC Online
          CPalliniC Online
          CPallini
          wrote on last edited by
          #4

          Quote:

          I need to add some methods to Z as virtual ones so that they will be overridden in Z child classes Z1, Z2, .. Zn. Is it possible, how can I do it.

          Yes it is possible. Just do it.

          In testa che avete, signor di Ceprano?

          D 1 Reply Last reply
          0
          • CPalliniC CPallini

            Quote:

            I need to add some methods to Z as virtual ones so that they will be overridden in Z child classes Z1, Z2, .. Zn. Is it possible, how can I do it.

            Yes it is possible. Just do it.

            D Offline
            D Offline
            Davie21240
            wrote on last edited by
            #5

            You might not need to make them virtual.

            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