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. VTBL

VTBL

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 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.
  • I Offline
    I Offline
    IWannaTalk
    wrote on last edited by
    #1

    I will try to write question shortly :) struct CEvents { virtual HRESULT Method1() = 0; virtual HRESULT Method2() = 0; virtual HRESULT Method3() = 0; }; class A : public CEvents { // Implementation of VTBL methods virtual HRESULT Method1(); virtual HRESULT Method2(); virtual HRESULT Method3(); HRESULT Some(); B *m_B; }; HRESULT Some() { m_b->Initialize( (CEvents*)this ); return S_OK; } class B { CEvents *m_evs; HRESULT Initialize( CEvents *evs ); } HRESULT B::Initialize( CEvents *evs ) { ///////////////////// THIS IS MY QUESTION ///////////////// // This i have trouble... access violation and ect.... // But when i use not pointer to class B as member of A ( B *m_B; ) // there is no any problems - PLEASE, TOLD ME, WHY?????????????? m_evs = evs; return S_OK; }

    ISQ 469907496

    D M 2 Replies Last reply
    0
    • I IWannaTalk

      I will try to write question shortly :) struct CEvents { virtual HRESULT Method1() = 0; virtual HRESULT Method2() = 0; virtual HRESULT Method3() = 0; }; class A : public CEvents { // Implementation of VTBL methods virtual HRESULT Method1(); virtual HRESULT Method2(); virtual HRESULT Method3(); HRESULT Some(); B *m_B; }; HRESULT Some() { m_b->Initialize( (CEvents*)this ); return S_OK; } class B { CEvents *m_evs; HRESULT Initialize( CEvents *evs ); } HRESULT B::Initialize( CEvents *evs ) { ///////////////////// THIS IS MY QUESTION ///////////////// // This i have trouble... access violation and ect.... // But when i use not pointer to class B as member of A ( B *m_B; ) // there is no any problems - PLEASE, TOLD ME, WHY?????????????? m_evs = evs; return S_OK; }

      ISQ 469907496

      D Offline
      D Offline
      DoomedOne
      wrote on last edited by
      #2

      Are you initialising the m_b member in the constructor of class A?

      Habetis bona deum

      I 1 Reply Last reply
      0
      • I IWannaTalk

        I will try to write question shortly :) struct CEvents { virtual HRESULT Method1() = 0; virtual HRESULT Method2() = 0; virtual HRESULT Method3() = 0; }; class A : public CEvents { // Implementation of VTBL methods virtual HRESULT Method1(); virtual HRESULT Method2(); virtual HRESULT Method3(); HRESULT Some(); B *m_B; }; HRESULT Some() { m_b->Initialize( (CEvents*)this ); return S_OK; } class B { CEvents *m_evs; HRESULT Initialize( CEvents *evs ); } HRESULT B::Initialize( CEvents *evs ) { ///////////////////// THIS IS MY QUESTION ///////////////// // This i have trouble... access violation and ect.... // But when i use not pointer to class B as member of A ( B *m_B; ) // there is no any problems - PLEASE, TOLD ME, WHY?????????????? m_evs = evs; return S_OK; }

        ISQ 469907496

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        I don't see anywhere that you actually create any objects. You have pointers declared but they are uninitialized. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        I 1 Reply Last reply
        0
        • D DoomedOne

          Are you initialising the m_b member in the constructor of class A?

          Habetis bona deum

          I Offline
          I Offline
          IWannaTalk
          wrote on last edited by
          #4

          ha, ha i so stuped!!! :) i forgot to do new B!!! :) i work to long... overwork oneself :) :) :) sory for this mes... :)

          ISQ 469907496

          1 Reply Last reply
          0
          • M Mark Salsbery

            I don't see anywhere that you actually create any objects. You have pointers declared but they are uninitialized. Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            I Offline
            I Offline
            IWannaTalk
            wrote on last edited by
            #5

            actually it was shortly sample...

            ISQ 469907496

            M 1 Reply Last reply
            0
            • I IWannaTalk

              actually it was shortly sample...

              ISQ 469907496

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              How should we help you then? What errors are you getting?  On what line(s)?  Compile or runtime? Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              I 1 Reply Last reply
              0
              • M Mark Salsbery

                How should we help you then? What errors are you getting?  On what line(s)?  Compile or runtime? Mark

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                I Offline
                I Offline
                IWannaTalk
                wrote on last edited by
                #7

                i have write answer for my question above... see third reply... :) i am ashamed of myself.... :)

                ISQ 469907496

                T 1 Reply Last reply
                0
                • I IWannaTalk

                  i have write answer for my question above... see third reply... :) i am ashamed of myself.... :)

                  ISQ 469907496

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  might be some one is intrested in the answer!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                  Never mind - my own stupidity is the source of every "problem" - Mixture

                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                  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