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
1 answer

Asp.net Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

After being plagued over a year with the dredded "Attempted to read or write protected memory. This is often an indication that other memory is corrupt", I have finally found a fix on it! Background: asp.net 4.0. Windows server 2003. Using MySQL…
user984314
  • 155
  • 1
  • 3
  • 14
0
votes
2 answers

How to use AVAudioPlayer to play MP4?

I want to use AVAudioPlayer to play MP4 files from iTunes generator. I could use UIWebView to play it and it worked, but I want to put an image of my choice on the background of the player instead of the "QuickTime"-logo. Here is an example of the…
RoundOutTooSoon
  • 9,821
  • 8
  • 35
  • 52
0
votes
1 answer

public nested classes inheriting from protected nested classes?

In order to implement my own iterators, I would like to implement something like this : class MyClass : { public: class MyIterator1 {;}; class MyIterator2 {;}; class MyIterator3 {;}; }; As these iterators will share some…
Vincent
  • 57,703
  • 61
  • 205
  • 388
0
votes
2 answers

Multiple inheritance compilation error with inheriting protected functions and public variables C++

Im currently learning multiple inheritance and ran into a problem creating a function that inherits its previous ancestors variables and functions. The problem occurs in the showRoomServiceMeal() functions where i do the multiple inheriting. When i…
SexyBeastFarEast
  • 143
  • 1
  • 1
  • 7
0
votes
1 answer

How to make use of protected ranges in Google App Script?

As of 8th august it is possible to have protected ranges in spreadsheets. How can I access this functionality in my scripts? Thanks
Theo Köster
  • 51
  • 1
  • 7
0
votes
4 answers

Regarding accessing the protected method

There is a project named demo which consists of two packages, named aa and bb. In package aa I have a public class One which has a method with protected as a modifier. Now in the other package bb , I have a public class two which wants to access the…
user1582269
  • 285
  • 1
  • 6
  • 12
0
votes
1 answer

Using base class protected methods inside overriden (new) function of derived class

I was trying to acomplish something similar to Java "super" call which i thought would be possible in this way : public ref class base { public: base(){} protected: virtual void funct() { MessageBox::Show("base funct"); } }; public ref class…
user1079475
  • 379
  • 1
  • 5
  • 17
0
votes
2 answers

Using directive in Derived Class changes inheritance to Public

A very simple question but yet confusing: Why does a using directive change the inheritance!? This compiles with Comeau. I have read that a using directive (decleration?) makes the variable public, but why? What I want is just a nice method not to…
Gabriel
  • 8,990
  • 6
  • 57
  • 101
0
votes
1 answer

word.open() error - Attempted to read or write protected memory

I am trying to open the word document as follows. wordDocument = wordApplication.Documents.Open(ref paramSourceDocPath, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref…
moejoe11
  • 885
  • 3
  • 11
  • 14
0
votes
2 answers

PHP protected file access

I am using Martin Barker's code/answer from ( PHP to protect PDF and DOC ) almost verbatum, only difference is the file I am protecting is in my user folder above the public_html folder Folder structure /users/websupport /public_html File to…
John Cogan
  • 1,034
  • 4
  • 16
  • 39
0
votes
1 answer

Using a method to get Embedded Font Causes Protected Memory Error

I am using this code to get an embedded font: /// /// Returns an Embedded Font /// /// String begins with namespace e.g MyProgram.Image.png /// public…
ρσݥzση
  • 217
  • 3
  • 13
0
votes
3 answers

super protected java

A question about inheritance in java... class Base { private int val = 10; } class Derive extends Base{ public void setVal(int value) { super.val = value; } } Since we can change the private field in super class using super…
alaska
  • 151
  • 2
  • 8
0
votes
1 answer

Understanding inheritance of Objective-C instance variables

I would like to extend a method of a superclass A with new functionality by subclassing it in B. Since instance variables default to @protected, accessing them should be fine. However, changes to an instance variable x that I make in the method of A…
Etan
  • 17,014
  • 17
  • 89
  • 148
0
votes
3 answers

get protected attribute by parameter referencing name?

lets say: class myclass{ protected $info; protected $owner; __construct(){ $this->info = 'nothing'; $this->owner = 'nobody'; } function getProp($string){ return $this->$string; } } But its not…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
0
votes
1 answer

Setting up a Mockery's Expectations in relation to protected methods

I'm running into a problem with trying to set up a Mockery to test for method invocation. I saw How to test protected methods of abstract class using JUnit and JMock and it's essentially the same question, but I can't make out what Chris is…
Joishi Bodio
  • 438
  • 6
  • 17