Static And Dynamic Binding In C++

Поделиться
HTML-код
  • Опубликовано: 4 дек 2024

Комментарии • 34

  • @solomizan
    @solomizan 11 месяцев назад +2

    Thank you, sir! You have cleared up my confusion. Jajakallah Khairan.

  • @yogendrahada1972
    @yogendrahada1972 7 лет назад +8

    I think u got it wrong. Whenever we use virtual keyword, compiler defers the function call resolution for the runtime. So, at the runtime, it checks what the type of object is(Base or Derived) and then it selects the appropriate vptr and call the function from the corresponding vTable. Ref: Thinking in C++

    • @CppNuts
      @CppNuts  7 лет назад +3

      +Yogendra Hada hi..
      you are right about the vptr and vtable, it doesn't check object type at run time, it simply uses something like: obj->vptr->vtable[0].
      on the object what it gets. and this happens at compile time. so if you have something like obj->fun1() this will be replaced with obj->vptr->vtable[0] at compile time. At run time only one level of indirection happen and that is, it goes to location 0 and take take address of function and put here and call it with parameters..
      (0 is the location where fun1 address is stored) it is little difficult to explain here i will creat different video for that.
      wait for some time..
      and i am not wrong, i just don't wanted to include vptr and vtable question in static and dynamic question bcoz they are different questions. :)

    • @sivaramakrishnachitithoti1428
      @sivaramakrishnachitithoti1428 3 года назад +1

      Roopesh is not wrong yog.. He is trying to explain the main subject (static and dynamic binding ).. If you want detailed explanation about vptr, vtable etc, then you need to go through some other video. Because vptr , vtable etc., kind of concepts will take more video length.

  • @theradhikagupta
    @theradhikagupta 5 лет назад +2

    I have few questions related to dynamic linking : what is Global offset table , what is procedure linkage table and what is pic (procedure independent code)

    • @EvilSapphireR
      @EvilSapphireR 3 года назад

      Procedure linkage table is an array of addresses left by the compiler in an ELF file to be filled with addresses of the dynamically loaded library functions the ELF depends on during runtime. Compiler while creating the ELF file designates space for this array inside the file and 'tags' it as PLT, and during execution (runtime) when the ELF file is actually loaded inside a memory address space along with other libraries the ELF file depends on, the loader searches for the library functions needed for the ELF to run and populates the PLT with the the runtime address of these functions.

  • @Turjak_art
    @Turjak_art 7 лет назад +6

    thank you nice an short explanation

  • @__hannibaalbarca__
    @__hannibaalbarca__ 2 года назад +1

    Hi; you should notice that you are use pointer; what if call function by value
    F(C c){c.func();}
    G(C& c){c.func();}
    Try it?

  • @terigopula
    @terigopula 6 лет назад +3

    Please try to explain the "WHY". "WHAT" is available everywhere. :(

  • @mohammedshaikh8343
    @mohammedshaikh8343 2 года назад

    thanks

  • @AshwinTechmind
    @AshwinTechmind 5 лет назад

    What is the name of this software in which you are coding

    • @CppNuts
      @CppNuts  5 лет назад +2

      Sublime Test Editor.

  • @xpopa
    @xpopa 3 года назад

    Thank you man.

    • @CppNuts
      @CppNuts  3 года назад

      You're welcome!

  • @sonulohani
    @sonulohani 7 лет назад

    Pls cover one video on static and dynamic linkage

    • @sonulohani
      @sonulohani 7 лет назад

      sorry its external and internal linkage.

  • @bossysmaxx3327
    @bossysmaxx3327 Год назад

    good bhai meri ignou ka exam pass kara diya aapne

    • @CppNuts
      @CppNuts  Год назад +1

      Areee waah kyaa baat hai.. 👍👍

    • @bossysmaxx3327
      @bossysmaxx3327 Год назад

      @@CppNuts thanks bhai

  • @atata0215
    @atata0215 5 лет назад

    thanks for this video , what about defining the function in Derived class virtual and in base class without?
    i have tried, and the compiler has shown:
    Base fun
    Base fun
    it hasn't care about the new Derived, although the func. in Derived class is virtual
    can you pls explain ?

    • @bissallahekele5320
      @bissallahekele5320 5 лет назад +1

      Since you didn't specify virtual in the base class, the compiler will not treat the function as such. The method call will be complete at compile time and no check will be made at run.

  • @TechnologyFighters
    @TechnologyFighters 6 лет назад +1

    👌

  • @bittupandey6645
    @bittupandey6645 3 года назад

    coool

  • @bissallahekele5320
    @bissallahekele5320 5 лет назад

    Really nice video!
    Is there an advantage in using pointers?

    • @CppNuts
      @CppNuts  5 лет назад +1

      Thanks Man!!
      Reference will also do the job.

  • @SunilKumar-ie2jh
    @SunilKumar-ie2jh 2 года назад +1

    Video is not useful for Beginners!

  • @rahuljojare
    @rahuljojare 5 лет назад +1

    Bhai kidharrr thoda achese smzao deeply

    • @CppNuts
      @CppNuts  5 лет назад +3

      Kosis kiyee hongee hum per ab tumko deep nahi laga to sorry, ek salah hai thoda google kero aur bhi padhoo.
      Kabhi bhi pura gyaan eek jaga se nahi hasil hota hai. 🙂

  • @prateekdhaman9618
    @prateekdhaman9618 6 лет назад +1

    abe smjhana nhi ata to ku video bnate ho

    • @CppNuts
      @CppNuts  6 лет назад +3

      Kyaa samaj nahii ayaa bee 😀😀