Questions tagged [protected]

`protected` is an access specifier in object-oriented languages. When the members of a class are `protected`, there is restricted access to these members for other classes.

The protected keyword specifies access to class members in the member-list up to the next access specifier (public or private) or the end of the class definition. Class members declared as protected can be used only by the following:

  • Member functions of the class that originally declared these members.
  • Friends of the class that originally declared these members.
  • Classes derived with public or protected access from the class that originally declared these members.
  • Direct privately derived classes that also have private access to protected members.
  • In the Java language, classes in the same package as the class that originally declared these members.
1204 questions
0
votes
3 answers

access protected variable - complicated situation with inheritance and sub-classes

Hmm... I'm trying to break down my problem... There is a library with some classes that do almost what I want. I can't change classes of the library so I want to derive them and change what I need. In this case there is a derived class in the…
0
votes
0 answers

WordPress protected page with menu button and own login

I have a big issue and would like to ask you for help. I've migrated my Minecraft server's website under WordPress administration. Before I moved it under Wordpress it had login page to access GUI which contained few thing for communicating between…
0
votes
2 answers

How to properly use protected in singly linked list

I've successfully programmed a singly linked list by the following program: The header file is: #ifndef SLL_H_ #define SLL_H_ #include class node { protected: public: int key; node *next; node(); …
Cancan
  • 691
  • 3
  • 14
  • 23
0
votes
3 answers

Why to use access specifiers/Modifiers in Java?

I am learning Java and my question is Why to use access specifiers/Modifiers in Java? why we need to use Public, Private, Protected and Default access to class, Method or variables. If I am programmer then Obviously I know everything from program.…
0
votes
1 answer

Open a password protected text file

Is there anyway to read a Open a password protected text file in C# code. It is not an encrypted file but a password protected text file.
Smitha Kalluz
  • 309
  • 5
  • 10
0
votes
0 answers

Calling Execute() method from another class

I have an activity that I am creating. I am using another activity... so that when my activity executes the activity calls the execute of another activity. The issue is that the other activity has a Execute method that looks like this protected…
Brandon
  • 133
  • 1
  • 2
  • 11
0
votes
3 answers

Forcing a subclass to define a protected final instance variable

Sometimes I need a property in the superclass (e.g. ChessFigure) that should force the subclass (e.g. Pawn or Bishop) to implement a const (final) property. For example every Chess figure has its own Image, but it's static (but only static for the…
Luca Nate Mahler
  • 1,292
  • 2
  • 13
  • 28
0
votes
1 answer

How do I access protected data from a Request::forge in fuelphp

I'm currently writing unit tests to get full code coverage on an app. I need to get coverage on the controllers. To get a request object I use : $controller = Request::forge('mycontroller/view/1')->execute()->response(); How do I get access to…
Raath
  • 689
  • 1
  • 6
  • 21
0
votes
1 answer

Vimeo - Sending password via javascript api

i have embedded a protected vimeo video on a site. Is there any method to send the password via JavaScript API instead of force the user to type it? Thank you.
Mattia
  • 1
  • 2
0
votes
1 answer

Access private interface property by public method

I would like to ask you some opinion about what I'm doing. I know it works, but I'm not sure is proper to do what I'm doing. I have a superclass Building that need to expose two NSString, name and description. No one should be able to modify those…
Enrico Bottani
  • 124
  • 1
  • 8
0
votes
4 answers

Java how to implement and design an abstract class

I've run into a design problem in my java code. My application uses missiles, and there are different types of missiles that all work identical except they have 3 unique attributes. The constructor of a missile must know these attributes. I decided…
user2651804
  • 1,464
  • 4
  • 22
  • 45
0
votes
1 answer

Protected mode and physical addresses

When CPU is in protected mode it expects all addresses to be virtual. Kernel resides in physical memory and uses physical addresses for its internal purposes. When developing a driver driver framework routines must access some memory locations with…
igntec
  • 1,006
  • 10
  • 24
0
votes
0 answers

accessing arrays outside of the function that modifies it

I need to access an array outside of this function: enter code here // code in a .cc file void ldu1::decode_lcw() { uint16_t LCW_BITS[] = { 410, 411, 412, 413, . . . . . . . . ..... }; uint16_t LCW_BITS_SZ = sizeof(LCW_BITS)…
crash
  • 1
  • 1
0
votes
3 answers

What is the point of "protected" word in Java if it gives you the same access rights as default access?

Can anybody explain me why do we need "protected" word? If I understand correctly, default access: available in classes within the same package. protected access: default access in same package + available to inherited classes (sub-classes) in any…
George Revkov
  • 95
  • 3
  • 8
0
votes
1 answer

Can't access protected class member in a derived class

The errors are: d_start is a protected member of CourseActivity duration is a protected member of CourseActivity location is a protected member of CourseActivity class CourseActivity{ protected: StartTime* d_start; double duration; …