C++ Protected Access Modifier in Classes | CPP Object Oriented Video Tutorial

preview_player
Показать описание
In this cpp Object Oriented programming video tutorial, you will learn about the usage of protected access specifier or modifier in a class.

You will learn what is the use of protected access specifier, how to use it, what is the influence of it on the class members in detail with examples.

Learn Programming in HINDI at our youtube channel

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

I see this comments are pretty old, so just a reminder that there are still people that find this useful.
Thanks man keep up the good work.

gospodin
Автор

Ive come to a point where I click " Like " before starting your video becuz I know it won't disappoint me at all. Great work :)

TheticblogLive
Автор

wonderful and comprehensive video tutorial, kudos to anil for explaining this is such intricate detail, thanks a ton !! keep up the good work buddy !

rubensontale
Автор

10/10 playlist for learning oop. Thanks!

olivermechling
Автор

#include <iostream>

using namespace std;

class student {
protected :
string name;
};

class refer : student {
public :
void read() {
cin >> name;
cout << name;
}
};

int main() {
refer obj;
obj.read();
return 0;

}


This surely works because the name is protected is accessible is only to the next class and not after that class

adityashidlyali
Автор

4:18 here you can still setName by using

Person anil;
anil.setName("anil"); // due to the public

of coz in order to display it... you have to have another display() method.

sing
Автор

thanks for this vidous
what is the difference between protected and private ?

alimamdouh
Автор

4:55 member function cannot be accessed by derived class as u said

labkishorehembram
Автор

In this set of code, the subclass is accessing public elements of base class (here function "setname") but the function setname is used as an interface which can access the "name" of its own class. Then whats the application of protected word specifying in this set of code? Can anyone explain this?

vishalsharma
Автор

which software do u use for programming....??

shashankmaurya
Автор

hi bro could you tell me how to make Fullscreen in codeblock?

rathdarasath
Автор

Hello sir your tutorials is so amazing.. Sir I have a one question is that ..
using namespace std;
class Person{
protected:
string name;
public:
void setName(string iname){
name=iname;


}

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


}

};
int main(){

Person john;
john.setName("Jack");
john.display()
;

}
Sir tell me without making a inheritence why it is working?

shabbirali
Автор

I am not sure what's the difference between private and protected?

C__MehrabEvan
Автор

what is the differ between private and protected

obadakhatib
Автор

Sir can I write a CPP program without main()

learningisfun
visit shbcf.ru