Private Inheritance in C++ | Cpp Video Tutorial

preview_player
Показать описание
In this c++ OOPS video tutorial, you will learn about the private inheritance.

You will learn what is private inheritance, what is the use of it, what happens to class members when it is used to inherit from the base class, how to access the members in derived class when it is used in detail with example.

Learn Programming in HINDI at our youtube channel

Catch us on SocialMedia
Рекомендации по теме
Комментарии
Автор

Sir, if u are making a public inheritance of class Student in GStudent then setStudentName() can be also be accessed via GStudent object. There is no need to write GStudentName() function in GStudent Class.
This code works same :-
#include <iostream>
using namespace std;

class Person{
protected:

string name;

public:
void setName(string iname){
name = iname;
}

};

class Student : private Person{

public:

void display(){
cout<<name<<endl;
}

void setStudentName(string iname){
setName(iname);
}
};


class GStudent : public Student{

};

int main()
{
GStudent abhi;
;
abhi.display();

return 0;
}

abhijeetraj
Автор

Love u bro, even i didn't learn from my professor, ur teaching is better than my professor. Tq bro

sowmyasuresh
Автор

How succinct and to the point!!! Subscribed.

muralidhar
Автор

Hello Anil, thank you for this tutorial, benefited a lot from it.

yhr
Автор

You r so good, that sometimes i forgot to like

SHASHIKUMAR-pphg
Автор

Sir the function void display() is acts as a private because (class gstudent:private student )makes it private thus the display function cannot access.

InstituteByStudent
Автор

in void studentsetName (string iname) {
setName( string iname )
}


if i pass setname(string iname ) why is that there is a compiler error?

yogimaggi
Автор

can any 1 tell me what is the difference between "Friend" & "Inheritence".

rohitthakur
Автор

No clarity on what u r explaining plz explain properly

pradeepkumar-muyb
join shbcf.ru