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
-4
votes
2 answers

Protected member is not accessible through a pointer or object c++

Visual studio is telling me I can't access a member variable from and instance of a parent class. Something like this: class Point{ protected: int x, y; }; class Quadrilateral : public Point { protected: Point A, B, C, D; }; class…
Mai Phạm
  • 25
  • 1
  • 2
-5
votes
1 answer

Decompile protected C#

I have a C# program and i want to decompile it, i used [ILSpy & NetReflector] and everything worked fine the program was decompiled but the source was encrypted or protected in a way because all the .cs file doesn't content the exact code that i…
ASSAYYED
  • 3
  • 2
-5
votes
2 answers

access protected variable in derived class c++

I have a mother class and a derived daughter class. I am trying to access the protected variable 'familystuff' in the derived class. Both ways that I am trying to access it aren't working. When I compile and run it, I get the following output: 5 3…
Anja
  • 5
  • 4
-6
votes
6 answers

Java access a protected attribute

I am new to Java, need some help I have an abstract superclass that has 2 protected attributes public abstract class Superclass { protected int a = 0; protected int b = 0; ... } then I have a subclass that extends the superclass, and i…
Alessandroempire
  • 1,640
  • 4
  • 31
  • 54
1 2 3
80
81