protected

Why would only the prefixing return type of a java method execute ?

Hi, I am trying to understand some java code which for some reason appears to execute its return type class (the SQLExecutionInfo class) and nothing else within the method. Perhaps this is simply how the java works (i.e regardless of whether of what is within the method body the type of class being returned is first executed ??) The m...

Office Open XML (OOXML) Specification: Encryption

I am trying to understand how encrypted ("password protected") Office 2007 documents are bundled (specifically, Excel documents). I am experimenting with a known, password protected spread sheet. When I unzip the XLSX file, I encounter three entries: [6]DataSpaces (Directory) EncryptionInfo (File) EncryptedPackage (File) How is the ...

Do you ever use protected visibility in Rails?

Confession: I only use private and public visibility for my methods! I have a feeling this is a bad thing. But in Rails it just doesn't seem to come up as an issue. Does anyone have an example in Rails where it would be a big mistake not to use protected visibility? ...

Why does the "protected" modifier in Java allow access to other classes in same package?

What is the reason that in Java, a member with a "protected" modifier can not only be accessed by the same class and by subclasses, but also by everyone in the same package? I am wondering about language design reasons, not actual applications (e.g., testing) ...

Ok, we can have private identifiers in javascript, but what about protected ones?

Simple as that, can we emulate the "protected" visibility in Javascript somehow? ...

Is there a way to make a value accessible only to the parent of a nested class VB.NET?

In general, according to the OOP paradigm, my understanding of encapsulation basically says: If a member is private, it can only be accessed by the class. If a member is protected, it can only be accessed by the base class and any derived classes. If a member is public, it can be accessed by anyone. If I have a nested class, can I de...

Protected Constructors and MustInherit/ Abstract class

What is the difference between a class with protected constructors and a class marked as MustInherit? (I'm programming in VB.Net but it probably equally applies to c#). The reason I ask is because I have an abstract class that I want to convert the constructors to shared/static methods. (To add some constraints). I can't do this becaus...

C# 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 paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref par...

What is the best way to unit test a protected method in C++?

What is the best way to unit test a protected method in C++? In Java, I'd either create the test class in the same package as the class under test or create an anonymous subclass that exposes the method I need in my test class. Because neither of those methods are available to me in C++, what are suggested approaches for testing pr...

How can I protect part of an array in php from being modified?

I have an array in php like this: $myArray = array('name'=>'juank', 'age'=>26, 'config'=>array('usertype'=>'admin','etc'=>'bla bla')); I need this array to be accesible along the script to allow changes in any field EXCEPT in the "config" field. Is there a way to protect an array or part of an array from being modified as if it where d...

How to use AVAudioPlayer to play M4P

I want to use AVAudioPlayer to play M4p 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 "quick time" logo. Can you help me as how to do this? Here is an example of the m4p file I want to play with AVAudioPlayer. http://a80...

C++: Is there a way to forbid subclassing of my class?

Hi all, Say I've got a class called "Base", and a class called "Derived" which is a subclass of Base and accesses protected methods and members of Base. What I want to do now is make it so that no other classes can subclass Derived. In Java I can accomplish that by declaring the Derived class "final". Is there some C++ trick that can...

.htaccess file - modifying to allow scripting/plug-ins in a password protected directory

I have a directory in a website that the user has asked to password protect. Once I protected the directory, the webpages would no longer play the videos in the directory. The files use a plug-in from ProShow, and the have a file extension of (.px). At first I though it was the .js file that was being loaded from the ProShow website, but...

Protected data in parent class not available in child class?

Hi, I am confused: I thought protected data was read/writable by the children of a given class in C++. The below snippet fails to compile in MS Compiler class A { protected: int data; }; class B : public A { public: B(A &a) { data = a.data; } }; int main() { A a; B b = a; return 0; } Error Message: Microsoft ...

Java Subclassing, Possibly want to much???

I want something similar to protected, where only a class which implements the "protected" field and anything that subclasses it can access it. So, I want to be able to declare a variable in the base class as "private," but still be able to access it from a subclass. Perhaps this is against he very nature of the subclass, private, and/o...

C++ run time error with protected members

I am trying to do a homework assignment where we insert a string into a string at a specified point using a linked stack, hence the struct and typedef. Anyway, when I try to access stringLength in the StringModifier class inside the InsertAfter method, I get a run time error and I cannot figure out what the problem is. I should be able t...

why can't i access protected java method even thought i've extended the class?

Here's the documentation for the protected method: /** Converts jmusic score data into a MIDI Sequence */ protected javax.sound.midi.Sequence scoreToSeq(Score score) And I made this little class to extend the class that scoreToSeq method comes from: public class MidiSequence extends MidiSynth{ public Sequence getSequence(Score ...

Access protected member of a class in a derived class

Hi ho, i have an old codebase here, where they used protected member variables. Whether or not this is a good idea can be discussed. However, the code must have compiled fine with gcc3. I have a derived template class Bar that uses protected member x from class template Foo like so template <class Something> class Foo { public: //...

Accessing protected member functions from test code in C++

I've been racking my brain trying to think of the best way to access a protected member function from some test code in C++, here's my problem: //in Foo.h Class Foo { protected: void DoSomething(Data data); } //in Blah.h Class Blah { public: Foo foo; Data data; }; //in test code... Blah blah; blah.foo.DoSomething(blah.da...

How to limit subclassing of public abstact class to types in same assembly and thus allow protected members typed to internal types.

This question is similar to c# internal abstract class, how to hide usage outside but my motiviation is different. Here is the scenario I started with the following: internal class InternalTypeA {...} public class PublicClass { private readonly InternalTypeA _fieldA; ... } The above compiles fine. But then I decided that I ...