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.
1,205
questions
0
votes
0
answers
9
views
AllowedRoles in react lead to unothorized page, though role is correct [duplicate]
The target is to implement protected routes using RTKQuery and React Router 6. The problem is that whenever i reload the page I get redirected to unouthorized component, not to the outlet
I am trying ...
-1
votes
0
answers
20
views
Why overriding protected method is an exception in java [duplicate]
package1
└── Parent.java
└── Test.java
package2
└── Child.java
package package1;
public class Parent {
protected void zz() {
System.out.println("done");
}
}
...
1
vote
1
answer
30
views
What is the correct syntax for mock.Verify for a protected setup?
I have the following unit test:
[TestMethod]
public async Task ShouldGetExperimentalValuePost()
{
//arrange
var avd = ActualVesselData.Parser.ParseJson(File.ReadAllText(".\\TestFiles\\...
0
votes
0
answers
28
views
how to access protected method inside unit test on kotlin
is there a way to get inside protected value and access it on kotlin unit test, below are my doPost protected method, i tried with reflection but its not working, following this sample
https://...
-2
votes
1
answer
40
views
OOP in PHP - Inheritance - protected method error [closed]
//((inheritance))
class ParentClass
{
public function public_message()
{
echo "This is a Public message" . "<br>" . "from Parent class .";
}
...
-1
votes
2
answers
31
views
Why ant we have protected top level class in java? [closed]
If i have a top level class classA in packageA, and i want to make a classB extend classA, but i want to include classB in packageB, without any other class in packageB being able to have access to ...
0
votes
0
answers
15
views
Authorization required for downloading
i want to download a book from :
https://digimaze.org/api/storage/v1/books/212/file
but ( enter image description here ) occurs
anybody know how can i download this file?
this books are protected and ...
1
vote
0
answers
24
views
Exception of type 'System.AccessViolationException' occurred in Unknown Module. Attempted to read or write protected memory
I have created a c++ dll and using in the Project using [DllImport("dll")] while i am using this dll after build it crashes at following function AES_init_ctx();
This is my DLL Code:
"...
1
vote
1
answer
45
views
Inheritance, child class changing a protected field from Parent Class in C#
I am currently picking up C# and I have issue on understanding inheritance.
Here's my Code:
Here's the Parent Class:
class Member
{
protected int annualFee; // protected field =only ...
0
votes
1
answer
14
views
Typescript protected object contains public members
Why there is no compiler error, when writing dataField of protected object within class Something that is not derived of class parent?
I expected that this.obj.data and all properties are read-only. ...
1
vote
1
answer
84
views
What is the equivalent of Java's protected attributes in Nim?
I was playing around with OOP in Nim and when I tried to implement inheritance between two Nim types in different files, I encounter the following problem, when importing a type from other file could ...
0
votes
1
answer
35
views
How to pass uninstallation password to remote system via powershell to uninstall an application which is password Protected
I can silently uninstall application which doesn't have password Protected using Powershell .
Start-Process -Wait -FilePath $uninstall32 /SILENT
For password protected application (Setup created ...
0
votes
0
answers
12
views
Getting solr index fields list from protected solr instance by query
I have solr instance which is protected with username and password. How can I get solr fields list from protected solr
solr query to get all field list from protected solr instance
I have using solr ...
0
votes
1
answer
47
views
Can someone help me on usb debugging on android 4.1.2
when im turning on usb debugging it has a password like this
im just want to install custom recovery
so because that i cant install custom recovery
enabling developer>enabling usb debugging>...
1
vote
2
answers
76
views
Is there a difference between protected class methods and private class methods in Ruby?
I'm trying to understand the difference between private class methods and protected class methods in Ruby in terms of accessibility. I've provided a code example that I am using to study the ...
0
votes
0
answers
16
views
PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$content_type in [duplicate]
The above PHP error happens in PHP 8.1, and struggling to find a fix for this.
Code below, which is triggering the php uncaught error: Cannot access protected property shoppingCart::$content_type in
...
0
votes
1
answer
56
views
c++ 14 (VS 2015) shared_ptr with protected inheritance - no suitable user defined conversion
I'm getting a strange compilation error when using shared pointer with protected inheritance. The below simple code doesn't compile and gives error "no suitable user defined conversion" but ...
0
votes
0
answers
34
views
Modifying PageRoute Controller using ModalRoute 'can only be used within instance members..'
I have a Widget that based on certain user interactions modifies the AnimationController of the PageRoute.
It does this via ModalRoute.of(context)?.controller and whilst it works as expected it is ...
0
votes
0
answers
12
views
ParseFacebookUtils.logInWithReadPermissionsInBackground Permission denied
My User class is set to protect
I'm trying to sign-up using the ParseFacebookUtils.logInWithReadPermissionsInBackground method, but it's not working, I'm getting the message: "com.parse....
1
vote
0
answers
64
views
Is there a need to provide a std::mutex for std::async?
As stuff I mentioned above, Should I prodive a std::mutex for std::async in the following section? :
#include <vector>
#include <future>
#include <mutex>
#include <ranges>
int ...
0
votes
0
answers
14
views
Is it possible to hide a sheet from the editors of the file while maintaining the ability to edit it?
in google sheets I have a somewhat particular need: I have to hide some sheets from users while leaving them the possibility to edit these sheets.
Basically they can edit them but they can't see them.
...
0
votes
2
answers
92
views
How can I update a protected variable on the abstract class by its derived classes?
I would like to define an abstract Menu class, from which all the derived classes can inherit the functions, but i want that all derived classes can update a single protected vector variable on the ...
0
votes
0
answers
27
views
Copy a protected excel sheet into another file
I want to link a protected worksheet to another excel file.when I right click on the sheet name it, the move or copy option doesn’t exist.also when we unprotect the excel sheet the option to move or ...
1
vote
1
answer
370
views
VBA code to protect worksheet but allow filtering
I have a worksheet where i want to limit changes made by users but also allow columns to be grouped so i used the following code. I then realised i can't filter on the protected sheet so amended the ...
1
vote
1
answer
58
views
Does 'friend' declaration affect the accessibility of members in the Base class?
I am confused on the effectiveness of a friend declaration.
In the first example, this friend declaration in Base caused me to not get an error on d.j and d.k in the main() function.
However, in the ...
0
votes
0
answers
57
views
"methodX() is a protected member of MyClass" error inside class that extends MyClass
In the following code:
struct A{
protected:
virtual void IAmProtected() = 0;
};
struct B: public A{
private:
A * a;
protected:
void IAmProtected() override;
public:
void ...
0
votes
0
answers
21
views
Looking for a script to Unhide Protected cells in a Google Spreadsheet
I developed a system where the user fill in information about their micro-business plan. Many cells are protected because of the formula's or the defined outlook by printing.
In relation to the input ...
0
votes
1
answer
300
views
Accessing protected members from class implementation in TypeScript
I'm getting this error when trying to implement a protected member in TypeScript.
Is there a way to avoid it? Or am I doing something the wrong way here?
It seems that TypeScript does not recognize ...
0
votes
0
answers
16
views
How do I protect my formula cells from being edited by a user, but allow updates from a website (external source)?
What I want to do is protect the majority of my spreadsheet (there will be some cells that the user can edit - have worked out how to do that). But I want the other cells to be locked to prevent ...
0
votes
0
answers
15
views
Is it possible to open a file that only works on a specific flash memory without flash?
i had a presentation file named as "abc.exe" in the usb key and can only run with that usb key in it. I copied files just in case. Now usb key died and the presentation doesn't work. What ...
0
votes
0
answers
10
views
Protected range script do not work. Google sheets [duplicate]
I try to protect line after change cell in forth row by app script and have different behavior
function onEdit(e){
const sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (e.range....
0
votes
0
answers
30
views
Change Chart Axis in Protected Sheet via VBA not working
I am struggling to dynamically change the axis of my chart in a protected worksheet. The code below works fine on an unprotected sheet, but once I protect the sheet the code is not unprotecting the ...
0
votes
0
answers
19
views
Protected Routes in react with firebase auth for both admin and user [duplicate]
How to protect route in my react project. I have used firebase auth for authentifiaction. and my backend service is firebase. How can i protect my routes for both admin and user side. Admin and user ...
0
votes
1
answer
28
views
How can I access a protected variable in child class through an abstract class pointer?
I have an abstract class that I have derived from two child classes. One of them has a protected variable that the other one does not. To make the code more general, I have to use an smart pointer of ...
0
votes
0
answers
30
views
Confusing difference between protected static and protected instance member in Java [duplicate]
How would you describe the very confusing difference between
a protected instance member and
a protected static member
in Java?
(A member can be either a method or a variable.)
Regarding 1 (...
0
votes
0
answers
39
views
How can gaming companies protect 3d data?
I understand that people can use the model extraction program to get 3d models from overwatch2, wow, genshin, league of Legends, and so on. ex) 3d ripper DX ...
I think there are some game companies ...
0
votes
1
answer
258
views
multiple selection dropdown list not working on a protected excel sheet
The multiselect doesn't work if the worksheet is protected, even if the actual cell containing the dropdown list is unlocked. It just behaves like a normal data validation list, i.e. the code is ...
0
votes
0
answers
10
views
VBA insert a row on a protected sheet and keep formulas in new rows (figured out) but only want rows inserting after specific row number
Due to a few reasons regarding cell security and trying to consider user requests. I've been forced down a road to make a button that allows me to insert a user selected number of rows, below a user ...
0
votes
1
answer
131
views
Best way to password-protect folders on IIS
What is the best way to password-protect a folder on IIS with a single set of credentials to be shared by a group of users?
Our hosting service offers Plesk, which in turn offers a "password-...
2
votes
0
answers
106
views
Why can't I access the protected function in the derived class
I have a Base class and derived another class from it. The derived class has a function which takes as an argument const Base& and calls its protected member function. I get an error saying that ...
0
votes
1
answer
43
views
How to access to a function whose access modifier is protected and exists in a class that inherits from another class in c#?
public class a
{
protected virtual int mult(int x)
{
return x * x;
}
}
public class b : a
{
protected override int mult(int x) { return x * x * x; }
}
internal class Program
{...
0
votes
0
answers
97
views
How to mock a protected class whos instance is used by the tested method in Java?
I have a public POJO class whos constructor is protected & its setters are protected/private as well.
The only thing that is public is the getters.
public class RequestInfo {
private ...
0
votes
1
answer
49
views
Why can i only access protected members of a class inside a method of a child(derived class)?
#include <iostream>
using namespace std;
class parent
{
protected:
int main = 0;
};
class subclass : public parent
{
cout << main; //error
void function() //ok
{
...
2
votes
2
answers
103
views
C# const protected vs internal
Why is "internal const" being overridden in a child class but "protected const" can't?
Sample code:
class A
{
internal const string iStr = "baseI";
...
0
votes
1
answer
154
views
How can I protect a module variable that should only be readable through a pointer in fortran?
I have an example program that looks like this:
module important_module
integer, dimension(5), protected, target :: important_array
contains
function testFunction() result(important_array_pointer)
...
0
votes
1
answer
33
views
VBA stops working once the sheet is protected
I have a table with filter.
I wrote simple VBA so that when the user pick different option, the VBA will pick the filter and sort the table automatically. It works perfectly.
I then hide, lock and ...
0
votes
0
answers
26
views
404 with protected routes Express.js
Let's say we have unprotected and protected routes:
const router = require('express').Router();
// Unprotected routes
router.post('/signup', ...);
router.post('/login', ...);
// Protected routes
...
1
vote
0
answers
79
views
the purpose of using protected attributes Python [duplicate]
I'm learning Python, I've coded a bit in C++ before. I have simple very code:
class Car:
def __init__(self, mark):
self._mark = mark
class Bus:
def __init__(self):
self.audi = ...
3
votes
4
answers
901
views
C++ class: one getter/setter for all data members?
I tried to practice C++ through some OOP, and thus has class like this:
class Obj
{
protected:
cls1 class1;
cls2 class2;
......
clsn classn;
}
I really need to make these members ...
0
votes
0
answers
150
views
Is there an elegant way to access protected members with gcc typeof & offsetof from outside the class?
I'm working on a project written in both C and C++. The C part has a macro used to get a pointer to an object from a pointer to one of its members
#define START_OF_OBJ(ptr, type, member)({\
const ...