One Super and Two SubClasses in JavaScript (Hindi)

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 44

  • @himanshu2168
    @himanshu2168 5 років тому +6

    please explain why we reset the inheritance constructor?

  • @prachipatil5996
    @prachipatil5996 5 місяців тому +1

    Why we reset the inheritance constructor?

  • @kingkie9536
    @kingkie9536 4 роки тому +1

    Sabse jyada time laga apki iss video ko samghne ar cover karne me..........but maja ayya

  • @sanjaygarg1146
    @sanjaygarg1146 4 роки тому +2

    Sir please tell me why we are reset constructor ?

    • @akshdesai3390
      @akshdesai3390 6 місяців тому +1

      because by default prototype object has 2 fields. one is constructor and second is prototype. but for this line "Lenovo.prototype = Object.create(Mobile.prototype);" we override the prototype object and now it has not second field called constructor. so that's why we need to reset the constructor. and need to put this line as well "Lenovo.prototype.constructor = Lenovo;"

  • @ajazamin9843
    @ajazamin9843 2 роки тому

    sir here i think is a demerit
    function extend (child,parent) {
    child.prototype = Object.create(parent.prototype);
    child.prototype.constructor = child;
    } is fine, but when i try to add
    child.prototype.anything = function () {
    return(this.xyz);

    }
    and if i try to access this function through the object of its class it shows this function is not defined. why?

  • @shivbaboo3491
    @shivbaboo3491 2 роки тому +1

    Sir , why you make constructor reset ? samsung.prototype.constructor = samsung ..

    • @akshdesai3390
      @akshdesai3390 6 місяців тому

      because by default prototype object has 2 fields. one is constructor and second is prototype. but for this line "Lenovo.prototype = Object.create(Mobile.prototype);" we override the prototype object and now it has not second field called constructor. so that's why we need to reset the constructor. and need to put this line as well "Lenovo.prototype.constructor = Lenovo;"

  • @satyasahoo26
    @satyasahoo26 4 роки тому

    Very helpful tutorial.

  • @wildturtle2416
    @wildturtle2416 4 роки тому

    nice explanation

  • @kajalkashyap4068
    @kajalkashyap4068 5 років тому +2

    thanks for awesome video but ye smjh nhi aaya k constructor ko reset q krte h, bina reset kiye b work krta h...... please reply

    • @sam-001
      @sam-001 2 роки тому

      Same problem

    • @akashpagi07
      @akashpagi07 20 днів тому

      Default Behavior Without Reset
      • When you use Object.create() to set up inheritance:
      Ex. Child.prototype = Object.create(Parent.prototype);
      • The prototype of the child is now linked to the parent's prototype.
      • However, the constructor property of the child prototype now points to the parent's constructor instead of the child class constructor.
      Reset the Constructor?
      • Manually reset Child.prototype.constructor to Child to ensure instances of Child correctly identify their constructor.
      Ex. Child.prototype.constructor = Child;
      If you don’t reset the constructor, checking instance.constructor could give wrong results.
      For example, if you want to check if an object is an instance of a certain class, it might mistakenly say it belongs to the parent class.

  • @avkexpress8029
    @avkexpress8029 6 років тому

    owsm sir g very helpful to learn

  • @sam-001
    @sam-001 2 роки тому +1

    Mera work nahi ho raha inherent function

  • @adeelnaqvi1064
    @adeelnaqvi1064 5 років тому +1

    Why we need reset constructor in inheritance?

    • @akshdesai3390
      @akshdesai3390 6 місяців тому

      because by default prototype object has 2 fields. one is constructor and second is prototype. but for this line "Lenovo.prototype = Object.create(Mobile.prototype);" we override the prototype object and now it has not second field called constructor. so that's why we need to reset the constructor. and need to put this line as well "Lenovo.prototype.constructor = Lenovo;"

  • @amolbonde6318
    @amolbonde6318 4 роки тому

    Well described

  • @mohammadkaisam4099
    @mohammadkaisam4099 5 років тому

    sir agr super class k prototype k method me koi argument de na ho tw kese de ge

  • @Niamat-w9s
    @Niamat-w9s 6 років тому +2

    You are great.
    but how can I memorize those code? what should I do for that?

    • @_samirdahal
      @_samirdahal 5 років тому +2

      When you do big projects then you'll remember it automatically. Just practice, practice, practice.

  • @harrysingh4915
    @harrysingh4915 4 роки тому

    Sir iske baare mei batao plzz constructor reset kyu krte hai???

  • @_samirdahal
    @_samirdahal 5 років тому

    Sir recursion k liye video hai, please reply?

  • @deeprajmazumder6261
    @deeprajmazumder6261 4 роки тому

    bro aap ES6 ka use nehi kar rahe ho...getter, setter etc ka bhi use nehi kar rahe

  • @surajankita1
    @surajankita1 5 років тому

    what is the use of call(this)?..by this also we r accessing other members?

    • @raeesh2373
      @raeesh2373 4 роки тому

      accotding to c++ when access to funtion member that time we need to call it thas why we are using here some concept here but i am not sure

    • @sam-001
      @sam-001 2 роки тому

      @@raeesh2373 java karani chahiye yaa cpp

  • @sumitmakwana6104
    @sumitmakwana6104 6 років тому +1

    why reset the constructor ??

    • @akshdesai3390
      @akshdesai3390 6 місяців тому

      because by default prototype object has 2 fields. one is constructor and second is prototype. but for this line "Lenovo.prototype = Object.create(Mobile.prototype);" we override the prototype object and now it has not second field called constructor. so that's why we need to reset the constructor. and need to put this line as well "Lenovo.prototype.constructor = Lenovo;"

  • @og_roxy14
    @og_roxy14 4 роки тому

    Bhiya hmlog constructor kyu reset krte h iski kya jrurat h ??

  • @shubhambiniwale9623
    @shubhambiniwale9623 5 років тому +2

    *Samsung.prototype.constructor = Samsung;*
    Line kyu likhte hai sir? uski kya jarurat hai? usse code me kya effect hoga?

    • @johncena-qo2hq
      @johncena-qo2hq 4 роки тому +1

      Reset constructor
      Is code se constructor ko reset krte h

    • @shubhambiniwale9623
      @shubhambiniwale9623 4 роки тому

      @@johncena-qo2hq thanks John cena.😊👍

  • @magictricks9954
    @magictricks9954 5 років тому

    sir plz its your first video out of 86 that is a little confusing plz sir make a video again on this topic

  • @raeesh2373
    @raeesh2373 4 роки тому +2

    why we are using constructor reset ?? alert("plz any one can clear my doubt")

    • @akshdesai3390
      @akshdesai3390 6 місяців тому

      because by default prototype object has 2 fields. one is constructor and second is prototype. but for this line "Lenovo.prototype = Object.create(Mobile.prototype);" we override the prototype object and now it has not second field called constructor. so that's why we need to reset the constructor. and need to put this line as well "Lenovo.prototype.constructor = Lenovo;"

  • @anujsharma-og2ts
    @anujsharma-og2ts 5 років тому

    // class
    var Mobile=function (){
    };
    // prtotype method
    Mobile.prototype.getModel=function(){ return this.model;}

    var mob=new Mobile();
    document.write(mob.getModel());
    sir mujhe yahi par parameter deke model print karana ho to sir hum karenge, sir please help and reply to me

  • @pushkargoyal4278
    @pushkargoyal4278 4 роки тому

    i can do this also
    Object.call(Mobile());

  • @anishkumar221
    @anishkumar221 4 роки тому

    Why getmodule ?????

    • @og_roxy14
      @og_roxy14 4 роки тому

      Ye function h getModel() nam se yeha hum koi b namm rakh sakte h jaise ur name is anish to...getAnish()...etc

  • @creativity6495
    @creativity6495 5 років тому

    confusing

  • @Raghav-Sharma
    @Raghav-Sharma 3 роки тому

    You are too predictable now I guess your object name without seeing

    • @geekyshows
      @geekyshows  3 роки тому

      It will help to understand the concept easily. I also follow one pattern to explain various languages and frameworks so if A Person learns Django at Geekyshows He/She can easily grab other framework like Laravel at Geekyshows. I try to make them similar as much as possible.

    • @Raghav-Sharma
      @Raghav-Sharma 3 роки тому

      @@geekyshows yes I know that it's really convenient and easy to understand take this as complement thanks to your hard work I can easily understand the basics of the js