const Keyword Behaviour With Function Overloading In C++

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ม.ค. 2025

ความคิดเห็น • 52

  • @rajesh09ful
    @rajesh09ful 6 ปีที่แล้ว +5

    Precise, terse, with example. The way you nurtute this channel is much appreciated

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      Thanks for such a nice comment!!

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

    • @krishnagupta7208
      @krishnagupta7208 2 ปีที่แล้ว

      ​@@evolve1431 initializer list

  • @aditya.ishan27
    @aditya.ishan27 6 ปีที่แล้ว +7

    You have a deep knowledge of C++.

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      I try my best, thanks for your comment!!

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

    • @aditya.ishan27
      @aditya.ishan27 3 ปีที่แล้ว

      @@evolve1431 this is structural initialization Google this you will know what it is.

    • @krishnagupta7208
      @krishnagupta7208 2 ปีที่แล้ว

      ​​@@evolve1431 watch video of initializer list

  • @iamsiddhantsahu
    @iamsiddhantsahu 5 ปีที่แล้ว +2

    Your explanation are great, keep making such videos!

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว +1

      Sure dude, thanks for the comment!

  • @programmingwithht
    @programmingwithht 3 ปีที่แล้ว

    Awesome Channel On TH-cam It clear my all concept about C++

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Glad you think so!

  • @AkhileshSingh-y4v
    @AkhileshSingh-y4v ปีที่แล้ว

    Understood.
    Great work 😄

  • @AshokKumar-mk1nr
    @AshokKumar-mk1nr 5 ปีที่แล้ว +1

    Really very useful your videos.. Great work!!!

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว

      Thanks

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

    • @krishnagupta7208
      @krishnagupta7208 2 ปีที่แล้ว

      ​@@evolve1431 initializer list

  • @cid007007
    @cid007007 4 ปีที่แล้ว +2

    Thanks buddy... I really didn't knew we have constant object also in C++ ... :)

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว +1

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

    • @krishnagupta7208
      @krishnagupta7208 2 ปีที่แล้ว

      ​@@evolve1431 initializer list

  • @ankitahlawat4812
    @ankitahlawat4812 6 ปีที่แล้ว +1

    Great vaagdu...today i got this new concept

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      Glad it helped!!

  • @yogendragangwar9795
    @yogendragangwar9795 6 ปีที่แล้ว +1

    Very nice description

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      Thanks for appreciation!!

  • @unknow9075
    @unknow9075 6 ปีที่แล้ว +1

    int main()
    {
    ::function(7,6);
    }
    what is the use of using scope resolution with function call here?

    • @konstantinrebrov675
      @konstantinrebrov675 5 ปีที่แล้ว +1

      :: scope resolution operator without any class or namespace means global scope. It allows you to call a function inside the global scope if there is a function with same name inside a namespace.
      namespace foo {
      int function(int a, int b) { return a + b; } // function one
      }
      int function(int a, int b) { return a + b; } // function two
      int main()
      {
      ::function(7,6); // calls function one
      foo::function(7,6); // calls function two
      }
      If you have
      using namespace foo;
      int main()
      {
      ::function(7,6); // calls function one
      function(7,6); // calls function two
      }
      Please try it, compile this code.

  • @shirishareddy2795
    @shirishareddy2795 4 ปีที่แล้ว

    void print() const can we explain these prototype .plz

  • @sureshgoondla1917
    @sureshgoondla1917 ปีที่แล้ว

    can you explain about function overwriting?

  • @chengjiwei
    @chengjiwei 5 ปีที่แล้ว +1

    thanks for the information, but the template function actually allows like print(), and print(), can you explain a bit? thanks

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว +1

      Good question, but try to understand from another end of the problem, there is no difference when you overload print function with "const int" or just "int", so now there is no point in differentiating print() and print().

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

  • @biswaranjan3550
    @biswaranjan3550 6 ปีที่แล้ว +3

    Hello Sir,One doubt here what is the difference between( int& val) and (const int& val) .As per my knowledge (const int& val) in this case we cannot change the value of val right?

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      Yes correct..

  • @girishmortha4823
    @girishmortha4823 6 ปีที่แล้ว +1

    Can u suggest some books for such concepts with in the language. I have seen few of your interesting questions in C_FAQ book.

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว +12

      I have never ever follow any book, they were expensive and i was poor. My knowledge comes from stack over flow, i was following it too much and daily tracking what people ask and i tried to give answer for those questions. This is how i built my knowledge for c++.

    • @Impulse_Photography
      @Impulse_Photography 5 ปีที่แล้ว +1

      I like the book " Object Oriented Programming in C++" by Robert Lafore. It covers all the beginner -> intermediate level topics.

  • @Impulse_Photography
    @Impulse_Photography 5 ปีที่แล้ว

    What is the difference from const int& color(int& x, int& y) To The Function int& color(int& x, int& y) const (keyword const before function or after function)??

  • @arpithams
    @arpithams 5 ปีที่แล้ว

    not able to overload print function, its throwing compiler error

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว

      What print function?

  • @vigneshwarmohanraj1490
    @vigneshwarmohanraj1490 6 ปีที่แล้ว

    Dear team,
    I have a small clarification.
    I want multiple integers sep by spaces from stdin and store it in vector.
    Please help me on this
    /Vignesh

  • @evolve1431
    @evolve1431 3 ปีที่แล้ว

    can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Google initializer list in cpp, you will get detailed explanation.

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      @@CppNuts ya tqs now I understand we can intilize like general parameterized constructor also

  • @girishmortha4823
    @girishmortha4823 6 ปีที่แล้ว +1

    I think U forget to add the same scenario occurs when int or const int is used as return type or may be it was not highlighted.

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      I am not able to understand what you are asking?
      We can not overload on the basis of return types. Please provide some code to clarify.

  • @revarevanth1800
    @revarevanth1800 6 ปีที่แล้ว +1

    Super sir

    • @CppNuts
      @CppNuts  6 ปีที่แล้ว

      Thanks man!!

  • @vasireddyganesh
    @vasireddyganesh 4 ปีที่แล้ว

    Sir when we write
    Void print(int &val)
    What kind of value can val hold
    For example:
    Void print(int *val)
    Here val can take the addresses....
    While calling this function we need to call it by passing address of some object as an argument....
    Like wise what can &val hold ?

    • @evolve1431
      @evolve1431 3 ปีที่แล้ว

      can u please tell me why you wrote like this I cant understand----( :x{x} ) these thing over constructor defination , I couldn't understand why you wrote like this

  • @vvpChannel3112
    @vvpChannel3112 3 ปีที่แล้ว

    Thank you Sir

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Most welcome dude.