Parameterized Constructors in Inheritance | C++ Tutorial | Mr. Kishore

  Рет қаралды 60,909

Naresh i Technologies

Naresh i Technologies

Күн бұрын

Пікірлер: 64
@NareshIT
@NareshIT 5 жыл бұрын
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.Pichumani
@Mr.Pichumani 5 жыл бұрын
in previous vdo u told that constructor never participate in inheritance but here u r dealing with inheritance
@Impromptu21
@Impromptu21 5 жыл бұрын
sir we got error piz help out using this code
@xxxboy922
@xxxboy922 3 жыл бұрын
Bxnzmx
@naimahmed8495
@naimahmed8495 6 жыл бұрын
the lecture is very clear...for this reason it is very easy to understand...thanks sir for your kind help to understand briefly...
@nikhilghorpade3048
@nikhilghorpade3048 3 жыл бұрын
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
@mohitsaud2071
@mohitsaud2071 4 жыл бұрын
// 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
@kaulsambhav
@kaulsambhav 5 жыл бұрын
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.
@sadeeshkumarmsd
@sadeeshkumarmsd 2 жыл бұрын
Even though it is not giving correct answer sir
@NINEx7x
@NINEx7x 2 жыл бұрын
Glory to Naresh i TEchnologies
@pawanKumar-tt2ku
@pawanKumar-tt2ku 2 жыл бұрын
Sir what happen if in multiple level inheritance base classes have parameters than which statement in first line in derived class
@smarttube1141
@smarttube1141 6 жыл бұрын
error: cannot call constructor ‘marks::stu’ directly [-fpermissive]
@VinayKumar-nv1it
@VinayKumar-nv1it 5 жыл бұрын
Same here
@malli14nuk
@malli14nuk 5 жыл бұрын
@@VinayKumar-nv1it ==> marks(args):Stu(args) { }
@shashankojha3452
@shashankojha3452 5 жыл бұрын
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.
@nakulchauhan6713
@nakulchauhan6713 5 жыл бұрын
@@shashankojha3452 acha g, or kch... :D
@GULLAPUDILIKITHBCE
@GULLAPUDILIKITHBCE 2 жыл бұрын
constructor is used to make code easier, but during inheritance, I think it is best to use normal functions than constructors.
@maheswarigorantlagari4354
@maheswarigorantlagari4354 4 жыл бұрын
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
@srishti5400 Жыл бұрын
this man has got ultimate oops riz literally the best
@chandumadhumanthi9983
@chandumadhumanthi9983 4 жыл бұрын
Sir, initially u told that constructors never participate in inheritance but ur explaining using inheritance..
@sudhansushekharpatra7168
@sudhansushekharpatra7168 4 жыл бұрын
Yes........
@sharath5796
@sharath5796 3 жыл бұрын
how did we access the private data mem of base class in der class constructor ? we have to declare it protected first right??!
@tarunagarwal7748
@tarunagarwal7748 6 жыл бұрын
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.
@debasreebhattacharjee4387
@debasreebhattacharjee4387 6 жыл бұрын
constructor use in inheritance?please reply
@_nabin_8848
@_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.
@saikun0293
@saikun0293 4 жыл бұрын
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
@gowthamvijayakumar9499
@gowthamvijayakumar9499 2 жыл бұрын
Bro this is working , thanks
@ajaykharat8689
@ajaykharat8689 6 жыл бұрын
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.
@anmolgupta7639
@anmolgupta7639 3 жыл бұрын
Sir in this program stu::stu(name, space) have shown error while compilation... Help me to get it out.
@shubhamransing
@shubhamransing 6 жыл бұрын
Very important for me sir..
@bishalhalder6640
@bishalhalder6640 4 жыл бұрын
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
@ybnsnsh6425 Жыл бұрын
Could you please edit the lecture number in order,
@radharajput663
@radharajput663 4 жыл бұрын
Nice sir
@kumarshivam2010
@kumarshivam2010 7 жыл бұрын
What is derived class object and base class object. I am not getting it.
@AmanDeep-pi9pk
@AmanDeep-pi9pk 7 жыл бұрын
derived class object means child class or sub class object like marks m in main()
@Shiva_polishetty
@Shiva_polishetty 3 жыл бұрын
#include #include #include using namespace std; class base{ public: char name[20],course[20]; base() { cout
@sheshukumarsugurthu8887
@sheshukumarsugurthu8887 3 жыл бұрын
Same problem Name and course not copied into this->name and this->course
@sanjogshrestha1859
@sanjogshrestha1859 2 жыл бұрын
@@sheshukumarsugurthu8887 /* here is the solution */ #include #include using namespace std; class base{ char name[20],course[20]; public: base() { cout
@sanjogshrestha1859
@sanjogshrestha1859 2 жыл бұрын
#include #include using namespace std; class base{ char name[20],course[20]; public: base() { cout
@aamirmalla9898
@aamirmalla9898 5 жыл бұрын
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-jn9fm
@SumantKumar-jn9fm 4 жыл бұрын
Program is running without default constructor because you haven't declared default constructor in derived class, either declare in both or don't declare!!
@krishnakumari3804
@krishnakumari3804 5 жыл бұрын
Sir, while running this program it shows lot of errors
@aamirmalla9898
@aamirmalla9898 5 жыл бұрын
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.... }
@shishankrawat2105
@shishankrawat2105 4 жыл бұрын
Thank you very much @@aamirmalla9898. U helped a lot.
@allankumar7552
@allankumar7552 7 жыл бұрын
this program is so different.
@seraj_valley
@seraj_valley 5 жыл бұрын
Best ever
@rakeshdebata5060
@rakeshdebata5060 4 жыл бұрын
Well explanation sir but your program sometime gives an error during running 🙏👍🙏
@ashwinigowda5822
@ashwinigowda5822 4 жыл бұрын
Sir neenga Tamil ah
@MCA_HimanshuSeth
@MCA_HimanshuSeth 4 жыл бұрын
sir please make a video series on WINAPI
@anmolgupta7639
@anmolgupta7639 3 жыл бұрын
🙏
@suaeb175
@suaeb175 5 жыл бұрын
Thank you sir
Virtual class in C++ | C++ Tutorial | Mr. Kishore
15:53
Naresh i Technologies
Рет қаралды 116 М.
Multiple Inheritance in C++ | C++ Tutorial | Mr. Kishore
18:18
Naresh i Technologies
Рет қаралды 76 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Exception Handling in C++ Part-1 | C ++ Tutorial | Mr. Kishore
16:26
Naresh i Technologies
Рет қаралды 91 М.
Friend Function in C++ Part 1 | C++ Tutorial | Mr. Kishore
17:38
Naresh i Technologies
Рет қаралды 168 М.
File Handling in C++ Part 1 | C++ Tutorials | Mr.Kishore
12:29
Naresh i Technologies
Рет қаралды 105 М.
Hybrid Inheritance in C++ | C++ Tutorial | Mr. Kishore
13:09
Naresh i Technologies
Рет қаралды 53 М.
Constructor Introduction, Default Constructor in C++ | C ++ Tutorial | Mr. Kishore
19:37
Copy Constructor in C++ | C++ Tutorial | Mr. Kishore
14:13
Naresh i Technologies
Рет қаралды 158 М.
Constructor Overloading Example-1 | C++ Tutorial | Mr. Kishore
14:40
Naresh i Technologies
Рет қаралды 84 М.
Introduction to Inheritance in C++ Part 1 | C++ Tutorial | Mr. Kishore
9:33
Naresh i Technologies
Рет қаралды 122 М.
This Pointer in C++ | C ++ Tutorial | Mr. Kishore
13:07
Naresh i Technologies
Рет қаралды 194 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН