Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: goo.gl/HIB0wL
@Mr.Pichumani5 жыл бұрын
in previous vdo u told that constructor never participate in inheritance but here u r dealing with inheritance
@Impromptu215 жыл бұрын
sir we got error piz help out using this code
@xxxboy9223 жыл бұрын
Bxnzmx
@naimahmed84956 жыл бұрын
the lecture is very clear...for this reason it is very easy to understand...thanks sir for your kind help to understand briefly...
@nikhilghorpade30483 жыл бұрын
for those who are getting errors, plz use the below code for marks class class marks : public stu { int m,p,c; public: marks(char name[20], char course[20], int m ,int p, int c) : stu(name, course) // use this to pass name and course to student class constructor. { //stu::stu(name, course); //don't use this line this->m = m; this->p = p; this->c= c; } void showmarks() { cout
@mohitsaud20714 жыл бұрын
// Full code using devc++// #include #include #pragma GCC diagnostic ignored "-Wwrite-strings" using namespace std; class stu{ char name[20], course[20]; public: stu(){} stu(char name[20], char course[20]) { strcpy(this->name,name); strcpy(this->course,course); } void showstu(){ cout
@kaulsambhav5 жыл бұрын
In class Marks while calling the Stu constructor the scope operator that you used gives error. It should be Marks :: Stu(name, course) instead of Stu :: Stu(name, course). It gives a constructor error for permission while compiling.
@sadeeshkumarmsd2 жыл бұрын
Even though it is not giving correct answer sir
@NINEx7x2 жыл бұрын
Glory to Naresh i TEchnologies
@pawanKumar-tt2ku2 жыл бұрын
Sir what happen if in multiple level inheritance base classes have parameters than which statement in first line in derived class
after inheriting the base class into the derived class we do not need to use scope resolution operator for calling base class constructor. try using this class child(int c,int d):parent(c,d) { this->c=c; this->d=d; } what he has told is wrong.
@nakulchauhan67135 жыл бұрын
@@shashankojha3452 acha g, or kch... :D
@GULLAPUDILIKITHBCE2 жыл бұрын
constructor is used to make code easier, but during inheritance, I think it is best to use normal functions than constructors.
@maheswarigorantlagari43544 жыл бұрын
instead of defining syntax of parameterized why u can define data members in protective specifier.we can acess easy the stu members in marks
@srishti5400 Жыл бұрын
this man has got ultimate oops riz literally the best
@chandumadhumanthi99834 жыл бұрын
Sir, initially u told that constructors never participate in inheritance but ur explaining using inheritance..
@sudhansushekharpatra71684 жыл бұрын
Yes........
@sharath57963 жыл бұрын
how did we access the private data mem of base class in der class constructor ? we have to declare it protected first right??!
@tarunagarwal77486 жыл бұрын
sir when program get compile they give the error in define base class constructor in derive class constructor and also in main function insde when we declaratio of object.
@debasreebhattacharjee43876 жыл бұрын
constructor use in inheritance?please reply
@_nabin_8848 Жыл бұрын
you might encounter an error using the given code for that instead of calling the base class constructor inside the derived class constructor, you should call the base class constructor in the derived class using the member initialization list.
@saikun02934 жыл бұрын
Correct code is: class marks:public stu { int m,p,c; public: marks(char name[20],char course[20],int m,int p,int c):stu(name,course) { //stu::stu(name,course); this->m=m; this->p=p; this->c=c; }; void showmarks() { cout
@gowthamvijayakumar94992 жыл бұрын
Bro this is working , thanks
@ajaykharat86896 жыл бұрын
Parameterized Constructors Inheritance Rule in C++:- 1. Base class should have to contain a default constructor. 2. Base class parameterized constructor should have to invoked from inside the derived class parameterized constructor 3. Base class parameterized constructor should be the first statement in derived class parameterized constructor 4. Only one Base class constructor is called within derived class constructor.
@anmolgupta76393 жыл бұрын
Sir in this program stu::stu(name, space) have shown error while compilation... Help me to get it out.
@shubhamransing6 жыл бұрын
Very important for me sir..
@bishalhalder66404 жыл бұрын
Error: Class marks:public stu{ int m,p,c; Public : Marks( char name[20], char course[20],int m ,int p,int c) { stu:stu(name,course) ; //here was the error // You can also write marks::stu(name,course) ; this->m=m; this->p=p; this->c=c; } };
@ybnsnsh6425 Жыл бұрын
Could you please edit the lecture number in order,
@radharajput6634 жыл бұрын
Nice sir
@kumarshivam20107 жыл бұрын
What is derived class object and base class object. I am not getting it.
@AmanDeep-pi9pk7 жыл бұрын
derived class object means child class or sub class object like marks m in main()
@Shiva_polishetty3 жыл бұрын
#include #include #include using namespace std; class base{ public: char name[20],course[20]; base() { cout
@sheshukumarsugurthu88873 жыл бұрын
Same problem Name and course not copied into this->name and this->course
@sanjogshrestha18592 жыл бұрын
@@sheshukumarsugurthu8887 /* here is the solution */ #include #include using namespace std; class base{ char name[20],course[20]; public: base() { cout
@sanjogshrestha18592 жыл бұрын
#include #include using namespace std; class base{ char name[20],course[20]; public: base() { cout
@aamirmalla98985 жыл бұрын
The program is running without default ctor too? and yes who r getting error...it is of actually calling base class ctor in derived class ctor, follow as marks( mntion argumnts) : stu(name,course) { Code.... }
@SumantKumar-jn9fm4 жыл бұрын
Program is running without default constructor because you haven't declared default constructor in derived class, either declare in both or don't declare!!
@krishnakumari38045 жыл бұрын
Sir, while running this program it shows lot of errors
@aamirmalla98985 жыл бұрын
The program is running without default ctor too? and yes who r getting error...it is of actually calling base class ctor in derived class ctor, follow as marks( mntion argumnts) : stu(name,course) { Code.... }
@shishankrawat21054 жыл бұрын
Thank you very much @@aamirmalla9898. U helped a lot.
@allankumar75527 жыл бұрын
this program is so different.
@seraj_valley5 жыл бұрын
Best ever
@rakeshdebata50604 жыл бұрын
Well explanation sir but your program sometime gives an error during running 🙏👍🙏