private

Can I transform an object and access the private data members in C++?

I want to access a private data member in a class. There is no member function in the class to access the private data member. It is private. I want to take the class and some how crack it open. One method was to copy the declaration of the class, make the private member public and call the new class class something_else. Then I do a r...

Header class file to be used by others

Hi, I would like to know if there is a way to put only protected and public stuff on the header file .h, and all private stuff in the compile unit .cpp I need this because the library is going to be used by others, and I wouldn't like to have to copy and edit all .h files to remove private declarations and implementations. I tried but g...

Is it possible to set up a private Mercurial repository on Google Code?

I like the fact that Google Code is a free option for Mercurial hosting but, in the test project I set up I couldn't find a way to designate the repository as private. Ideally I would like to work on a project privately until it is ready for the world to see and only then open it up to others. Is there any way to do that on Google Co...

Defining private module functions in python

According to http://www.faqs.org/docs/diveintopython/fileinfo_private.html: Like most languages, Python has the concept of private elements: Private functions, which can't be called from outside their module However, if I define two files: #a.py __num=1 and: #b.py import a print a.__num when i run b.py it pr...

Java: Accessing private fields directly from another instance of the same class

I'm writing a equals(Object obj) function for a class. I see that it is possible to access the private fields of obj from the caller. So instead of using a getter: Odp other = (Odp) obj; if (! other.getCollection().contains(ftw)) { } I can just access the field directly: Odp other = (Odp) obj; if (! other.collection.contains(ftw)) {...

static/private child component in mxml?

Are there any way to declare a child component in mxml which is private/protected or even static? Sure we can do this inside a script tag, but are there any other way? ...

Are there good reasons for 'private' to work the way it does in Ruby?

It took me a while to understand how private methods work in Ruby, and it really strikes me as being very awkward. Does anyone know if there are good reasons for private methods to be handled the way they are? Is it just historic reasons? Or implementation reasons? Or are there good solid logical reasons (ie. semantic)? For example: c...

Is it possible to set private property via reflection

Can I set a private property via reflection? public abstract class Entity { private int _id; private DateTime? _createdOn; public virtual T Id { get { return _id; } private set { ChangePropertyAndNotify(ref _id, value, x => Id); } } public virtual DateTime? CreatedOn { get { return ...

Objective-C: what is private what is not?

Why are people using @interface ViewController : UIViewController { @private UIButton* button_; } @private declarations in public headers? Declaring a variable inside an implementation yields the same result, doesn't it? It feels strange to me, I thought a public header should only contain really public members. What to do with ...

Private methods using Categories in Objective-C: calling super from a subclass.

Hello folks, I was reading how to implement private methods in Objective-C (Best way to define private methods for a class in Objective-C) and a question popped up in my mind: How do you manage to implement protected methods, i.e. private methods that are visible to subclasses? Suppose I have a MySuperClass with a Category containing ...

PHP security question: store connection details in constants or private properties?

The title should say it all really - I was wondering if it's better to store connection variables as constants (because they can't be changed) or as private properties (because they can't be viewed). My apologies to all those who reel in horror at my lack of security nous... ...

How can I use externally generated keys to encrypt and decrypt the data in iPhone?

I am working on an application, in which I need to encrypt and decrypt the data, with the keys generated by server. I viewed the sample code of Crypto Exercise. In that keys are automatically generated. How can I use externally generated keys in the code? Please help. ...

Python: Public methods calling their 'brother' private methods.

Hi, I have been writing Python code for only a couple of weeks, so I'm still figuring out the lay of the land. But let's say I have a method that MAY be called on by a 'user' on occasion as well as used HEAVILY internally (ie, the arguments have already been checked before the call). Here is what I am currently doing: #The method the '...

Does python have 'private' variables in classes?

I'm coming from the JAVA world and reading bruce eckels' python 3 patterns idioms. While reading about classes...it goes on to say that in python there is no need to declare class variables. You just use them in the constructor...and boom..they are there. So for example: class Simple: def __init__(self1, str): ...

ERROR: iPhone Private Frameworks "No such file or directory"

I have added Private Frameworks To my project. When I build in DEVICE | RELEASE everything works fine and I am able to ldid -S the application and it successfully launches on my device. However, when trying to BUILD AND GO in Simulator, I get the error "No such file or directory" as indicated below: (I also get the error twice which is ...

Outer Java class is able to access inner class private members?

I observed that Outer classes can access inner classes private instance variables. How is this possible? A sample code demonstrating the same is explained below:: class ABC{ class XYZ{ private int x=10; } public static void main(String... args){ ABC.XYZ xx = new ABC().new XYZ(); System.out.println("H...

private methods using .net reflection. why??

Hi I used reflection many times before on public methods but never realized that private methods can be invoked too. See the link I am still thinking why is that allowed in the first place? Isn't that going to break the rule of "private" being "private"? puzzled AJ ...

abstract method override in Derived class, how to make private

Hi I have a class "A" with as abstract method protected abstract List<Contributor> GetContributors(List<SyndicationPerson> contributersList); I want to override this method in derived class "B" with following conditions It should be private to B class. compiler does not allow me to declare this Method as private in derived class "...

Is it possible to compare private attributes in Ruby?

I'm thinking in: class X def new() @a = 1 end def m( other ) @a == other.@a end end x = X.new() y = X.new() x.m( y ) But it doesn't works. The error message is: syntax error, unexpected tIVAR How can I compare two private attributes from the same class then? ...

Time sensitive webpage access.

Is it possible to create a page that redirects to a private page if a correct time sensitive variable is passed? Ex: http://www.mysite.com/redirectpage.aspx?code=0912042400 The code value is a year-month-day-time combination that must fall withing some time window (15 min, 30 min etc) based on the server's time. The redirectpage would...