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,175
questions
0
votes
0
answers
9
views
protecting python objects (variables, functions, classes, objects, anything)
Python does not support protection of any python objects. It would be "non-pythonic" to do so. However, I have a situation where I need to do so. This is not a regular application, or a ...
0
votes
1
answer
25
views
If Tradingview pro account expires, what will be the published protected script's type?
i wrote a script and i want to hide it's source code, so i need to upgrade my account to premium or pro account. I will buy 1 month plan but after 1 motnh later what will be my script's sitiuation? İs ...
0
votes
0
answers
69
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 ...
2
votes
1
answer
60
views
What's the problem(s) with overriding a method with different access in base vs derived class
PC-Lint issues a warning when a method is overriden in a derived class with access specifier other than what is the inherited access. For example
class B {
public:
virtual void fubar(void);
};
...
0
votes
2
answers
36
views
Private Route with React and Axios.get
Im trying to make a private route where if im not logged in, it will redirect to log in, if not then it will bring me to home but I'm struggling on making it work
my privateRoute.js
import React, { ...
0
votes
1
answer
25
views
Laravel REST protect given methods and make accessable per role
I have a laravel project which provides over rest api some public data on the other hand logged in users can manage some membership related datas.
Now in this dashboard I have couple of react ...
-1
votes
0
answers
33
views
Getting Error while using Protected access Modifier
I created the Main code in package com.dsa.access, and created a subclass in package com.dsa.oops. While accessing the protected member from access package in oops class I am getting an error.
Parent ...
1
vote
1
answer
40
views
Setting a class attribute of the type dict as private in python
I have the following situation (here a bit simplified):
class MyClass():
tables = dict
matrices = dict
def __init__(self, table_A, table_B=None, A=None, B=None)
self.tables = {'A':...
0
votes
1
answer
26
views
scrap Cdn-cgi email protecton
When I'm trying to scrap https://www.kw.com/agent/UPA-6904130219335225344-3 email, I'm a facing a problem. It showing [email protected].
How I can I solve this problem?
import requests as rq
from bs4 ...
2
votes
1
answer
60
views
Deriving class with protected equality operator results in deleted default
Suppose we have the following implementation:
class A {
protected:
bool operator==(const A&) const = default;
};
class B : public A {
public:
bool operator==(const B& b) const ...
0
votes
1
answer
31
views
JDA List/Collection of SelectOption
I cant create a List or a Collection of SelectOptions in JDA.
I tried it like that:
List<SelectOption> li = new ArrayList<>();
li.add(new SelectOption("", ""));
...
0
votes
0
answers
55
views
How to sign executable
Hi I just created a single c script and windows is saying "Windows Defended your computer" I tried to self sign my executable but it's still happening, if I want to share my programs how can ...
0
votes
0
answers
18
views
Access of a protected member functions through a pointer is not allowed [duplicate]
So, I want to create a class B that inherits from another class A, and A has a std::vector<A> Avecs as a protected member function.
What I want to do is access A's member function through ...
1
vote
2
answers
25
views
Which visibility modifier has lesser visibility: Protected or Internal?
Which visibility modifier is more permissive: Protected or Internal?
internal var num = 18
protected set // throws an error at 'protected' showing: Setter visibility must be the same or ...
1
vote
2
answers
46
views
How to test a protected member from multiple inheritance in GoogleTest?
Imagine I have a Foo class which contains a protected member. Foo is my template base class.
Then I have a Bar class, which inherits from Foo.
The protected member will be private within Bar.
I need ...
0
votes
1
answer
18
views
Is important to protect routes on mobile devices exactly?
I want to create a mobile app, only mobile devices from the app and play store, and I have a protected area for administrators, is important to protect them? The app will be reserved only for mobile ...
0
votes
0
answers
38
views
How do I initailize abstract class protected field?
class Program
{
static void Main()
{
Ant ant = new Ant();
ant.description="small"; //This line goes wrong
}
}
abstract class Pet
{
protected string ...
0
votes
2
answers
56
views
Java - Unable to access protected method of superclass extended by nested class
I'm new to java and getting the hang of protected visibility.
I have Class A which has protected method method1 as follows -
public abstract class A {
public A(...){}
protected void method1()...
1
vote
0
answers
43
views
What is the practical benefit of using protected attributes instead of private?
When I was reading Mark Lutz - "Learning Python Tom 2" book, I faced with the next example of private attributes usage:
class C1:
def meth1(self):
self.__X = 88
def ...
0
votes
0
answers
27
views
How to have protected routes in Reactjs?
I'm new to reactjs and nodejs. I have just completed the signup and login pages and now I'm trying to add protection to pages but it seems that whatever I did earlier has to be changed which is ...
0
votes
1
answer
93
views
Setting up protected routes in React with react-router-6
I am using keycloak for my React + Typescript app and I need to setup ProtectedRoutes so that certain paths can only be accessed when the user has logged in. I have the keycloak part working but for ...
1
vote
0
answers
40
views
Why is std::ctype's virtual destructor protected?
I was trying to write
std::ctype<char> c;
but I couldn't, because that class's is both protected (directly) and virtual (indirectly, through facet).
But I can do this just fine:
struct : std::...
0
votes
0
answers
30
views
Emgucv. Capture trie to write on protected memory.... Exception
I am struggling with the problem that after a few frames I receive an exception that I am writing on a protected memory. (Sry for the german screenshot).
I have no Idea how I could solve this problem.
...
2
votes
1
answer
106
views
C# - public getter and protected setter interface
Hello i'm working on a Unity game and i would like to create living entities.
To perform this, i want to create an interface for all entities having health
Here is my interface for LivingEntities:
...
0
votes
1
answer
54
views
Automatically protect / un-protect sheets or ranges when value is change from another source (google sheets)
There is a case where test is given to a certain student. The student can only work with the answer for the test before a given period.
Here is the sample case:
https://docs.google.com/spreadsheets/d/...
0
votes
1
answer
81
views
Protect Sheet when condition is met by change (Google Sheet)
There is a case where test is given to a certain student. The student can only work with the answer for the test before a given period.
Here is the sample case:
https://docs.google.com/spreadsheets/d/...
0
votes
1
answer
76
views
Destructor protected within this context c++ (issue #1) [duplicate]
I have a compilation error with C++11.
I have defined a base class Node with protected ctor and dtor. I have defined an inherited class Directory with public inheritance.
I am calling the dtor of the ...
0
votes
0
answers
38
views
How to detect if a member of a class was invoked inside or outside of that class?
My JavaScript protected member implementation for a Super class (lines 3-47) below uses # (lines 4-5) to make private members, $ (lines 4-5) as a protected member marker, and returns a Proxy object (...
0
votes
0
answers
89
views
Protect the react routes with two different layouts childrens
I am protecting the routes and making sure the if no route found or if the user does not loggedin, then redirects the user to login page. I have tried a lot solutions but nothing work for me.I have ...
2
votes
0
answers
17
views
Function In Derived Class Unable To Access Protected Constructor [duplicate]
I am trying to understand why 'return new A(x)' is giving us an error saying " ‘A::A(int)’ is protected within this context ".
I am aware that protected member functions can be accessed ...
0
votes
0
answers
93
views
Override Plugin with Protected function
Need help to override this protected function.
Plugin : checkoutwc / Checkout for woocommerce
File : ./plugins/checkout-for-woocommerce/includes/Model/CartItem.php
I have already tried to use a copy ...
0
votes
1
answer
57
views
Preventing descendants from overriding method
In C++ (11/14/17, I don't care), I have a base class B which exposes method x as protected.
In class D1, which derives from B, I want to prevent further descendants (of D1) from calling x(). Now, if ...
0
votes
1
answer
87
views
What becomes the visibility of protected members in a subclass?
I have a class A with a protected member :
package p1;
public class A{
protected int number;
}
Now I've subclassed it in another package :
package p2;
public class B extends A{}
Now in the ...
1
vote
0
answers
67
views
Overriding a .NET protected member in F# produces a public member
I have encountered a seemingly "weird" situation. Repro:
Create an F# library
Add a component class type, inheriting ComponentBase
Override BuildRenderTree
//Comp1Base.fs
namespace ...
0
votes
1
answer
59
views
Is it ok to inject additional data into a module's scope? Or: What are the possibilities of managing/exposing module scoped state from/to the outside?
I am designing Javascript modules using the Revealing Module Pattern. In my html I have onmouseover="Test.OnLoad()". I need a callback after that is completed. I set the callback with Test....
0
votes
1
answer
249
views
Best way to maintain Google sheet permissions when creating a copy
each month I create a copy of a google sheet file. It has quite a few sheets that have permissions - protected formula fields. The issue is, when copy is created only the owner can edit the protected ...
0
votes
0
answers
54
views
deep clone method in generic class
we are implementing a linked list class using node objects (which we also created) in my class. We decided to override the clone method to show the difference between shallow and deep cloning. But I ...
0
votes
1
answer
105
views
How to access Protected methods from a class library in c#
I have a library in which a protected method is there whose definition is as below :
public class InvokeCalc : IInvokeCalc
{
protected InvokeCalc(OtherClass comm);
public OtherClass();
}
...
-1
votes
3
answers
167
views
why i cannot access protected member of a class from 3 rd class in another package? [duplicate]
I have 3 classes
package a;
public class A {
protected void add(){}
}
package b;
import a.A;
public class B extends A {
public static void main(String[] args) {
B b=new B();
...
-2
votes
1
answer
80
views
Protected variable not accessible within child class in Java
I have the following structure -
App.java -
package JohnParcellJavaBasics.AccessModifierDemo;
import JohnParcellJavaBasics.AccessModifierDemo.*;
public class App {
public static void main(String[]...
0
votes
1
answer
112
views
Cannot access method 'Handle' MediatR due to its protection level .net using xunit
I want to test a handler that is protected due to the AsyncRequestHandler interface in MediatR.Here is my handler :
public sealed class AddUserDeviceCommandHandler : AsyncRequestHandler<...
1
vote
0
answers
73
views
Java - Modify attributes of an object from a different class with protected methods
I am trying to swap cells in a board. I have the class Cell with attributes such as coordinate (position in the board). This class has the method setCoordinate as protected.
I also have the class ...
0
votes
1
answer
77
views
Creating own moveto() function in C for use in 0x13 VGA mode xv6
I need to draw a square using 4 system call methods that I create personally. I cannot use things like graphics.h
The functions I'm required to make are as follows (not including params):
int ...
1
vote
1
answer
109
views
Force Push Not Allowed
resubmitting the same files to remote branch
I am working on a project of my university.
I have already submitted the corrupted files of project (degrees.py, small.csv ... etc) to remote branch 1, ...
0
votes
0
answers
27
views
How to setup mock for a protected generic method of base class?
I want to mock protected generic method of my baseclass. Is it possible to do that? Below is my code sample of method which want to mock.
protected MyResponse ProcessRequest<TRequest, TResponse, ...
0
votes
0
answers
29
views
Bypass protected (on Hardware Event) functions in LUA (Warcraft)?
I want to call a protected function C_FriendList.SendWho() in World of Warcraft but it requires a hardware event.
Is there anyway I can simulate that hardware event?
Someone figured it out on another ...
-1
votes
1
answer
50
views
Google Apps Script Range Protection Lock Tab color and Tab Renaming
A spreadsheet with multiple tabs have 10 editors/access. I wanted to lock some ranges in each tab from 8 of those editors.
When I ran google app script written below, it also lock the 8 editors from ...
1
vote
2
answers
105
views
Kotlin protected property can not be accessed in other module
Just when I thought I understood it, I got the following issue.
I have a base class in another module (called base here)
It looks like that:
open class BaseTest {
companion object {
...
1
vote
1
answer
108
views
in kotlin, how to access protected static member in parent class from sub class
It is code worked in java but after convert to kotlin it does not compile.
Having a base class which has some defines as static protected member in the companion object:
abstract class ParentClass {
...
2
votes
1
answer
156
views
How to make variable in companion object protected
I want to make a variable in companion object protected. I think when I make the variable protected, it would be accessible only from another class which inherit the variable's class, not from other ...