private

In C++ when should someone make a private function virtual?

Possible Duplicate: Why would a virtual function be private? I've seen private virtal functions declared here and their in C++ but I'm not entirely sure as to its purpouse design wise, are their any cases where it is beneficial to have a private virtual function? ...

Auto-push changes to one folder in a git repository to github?

I have a repository that I work in. There's one folder in there where I put all the stuff I want to open source so it's separate from the private parts. Is there a way to automatically get git to push anything committed to that folder to a github repository without me having to remember to push the newly changed files up there every time...

what does this refer to in a javscript private method

Using the following bit of code: function Node(){ .... function foo(request){ for (var name in this ) { log(name +" is "+this[name]); if(!(name == 'all' || typeof this[name] == 'function')){ request[name] = this[name]; } } return ... }; } I was surprise...

C++ Is private really private?

I was trying out the validity of private access specifier in C++. Here goes: Interface: // class_A.h class A { public: void printX(); private: void actualPrintX(); int x; }; Implementation: // class_A.cpp void A::printX() { actualPrintX(); } void A::actualPrintX() { std::cout << x: } I built this in to a stat...

Nested class in javascript, inheritance of private methods.

Hi to all, i'm quite a newbie in javascript, and i'm spending some time trying to create namespaced objects in js. Now, that's what i'm trying to do: MainObject = function() { var privateVariable = "i'm private"; var privateMethod = function() { // doSomething } this.publicMethod = function() { // doP...

php private mysql connection

I have 2 functions, the function get_user_info() which connects to a db called 'users', and another, called print_info() which connects to a db called 'blah'. I call get_user_info() inside print_info(), so it can retrieve the information. They connect to 2 different databases and make 2 different connections, i use another function to co...

C++ template class T trouble

template <class T> class List { public: List(); ~List(); ... protected: template <class T> struct Item { struct Item* next; T data; }; ... struct Item<T>* allocate(); }; template <class T> struct Item<T>* List<T>::allocate() // error he...

How to get instance of nested class in C++

I have the following code: class outer { struct inner { int var1; int var2; inner() { var1 = 1; var2 = 2; } }; inner inner_instance; public: const inner *get_inner() { return &inner_instance; } }; int main(int argc, char *argv[]) { // 1 outer outer_instance; cout << outer_instan...

how to make a single method in a class to private in Objective-c?

how to make a single method in a class to private in Objective-c? ...

Ruby private instance variables, with exceptions

I am making a card game in ruby. I have the Game class, which has an array of Player objects. array_of_players = Array[ Player.new("Ben"), Player.new("Adam"), Player.new("Peter"), Player.new("Fred"), ] my_game = Game.new(array_of_players) puts my_game.players[2].name #=> Peter Each player also has access to the Game, so ...

Does importing of packages change visibility of classes?

I jsut learned that A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package. This is a clear statement. But this information interfere with my unders...

Copy constructor using private attributes

Hello all, My first question here so be gentle. I would like arguments for the following code: public class Example { private String name; private int age; ... // copy constructor here public Example(Example e) { this.name = e.name; // accessing a private attribute of an instance this.age = e.age;...

Closest Ruby representation of a 'private static final' and 'public static final' class variable in Java?

Given the Java code below, what's the closest you could represent these two static final variables in a Ruby class? And, is it possible in Ruby to distinguish between private static and public static variables as there is in Java? public class DeviceController { ... private static final Device myPrivateDevice = Device.getDevice("myd...

How to use private key

Hi, In my search i found out that we can generate private key called myrsakey.pem.What is the purpose of this key where this key is used.Help me. Regards Sharun. ...

Can I write functors using a private nested struct?

Given this class: class C { private: struct Foo { int key1, key2, value; }; std::vector<Foo> fooList; }; The idea here is that fooList can be indexed by either key1 or key2 of the Foo struct. I'm trying to write functors to pass to std::find_if so I can look up items in fooList by each ...

Error code while trying to use private variables in a function

I get an error that says Parse error: syntax error, unexpected T_PRIVATE in E:\PortableApps\xampp\htdocs\SN\AC\ACclass.php on line 6 while trying to run my script. I'm new to classes in PHP and was wondering if someone could point out my error. Here's the code for that part. <?php class ac { public function authenticati...

A pragmatic view on private vs public

Hello everybody! I've always wondered on the topic of public, protected and private properties. My memory can easily recall times when I had to hack somebody's code, and having the hacked-upon class variables declared as private was always upsetting. Also, there were (more) times I've written a class myself, and had never recognized an...

Is it good practice to put private API in the .m files and public API in .h files in Cocoa?

Many of my classes in my current project have several properties and methods that are only ever called from within the class itself. Also, they might mess with the working of the class depending on the current state of the class. Currently, all these interfaces are defined in the main interface declaration in the .h files. Is it consider...

C# Reflection - Casting private Object field

I have the following classes: public class MyEventArgs : EventArgs { public object State; public MyEventArgs (object state) { this.State = state; } } public class MyClass { // ... public List<string> ErrorMessages { get { return errorMessages; } ...

How to make images hosted on Amazon S3 less public but not completely private?

I fired up a sample application that uses Amazon S3 for image hosting. I managed to coax it into working. The application is hosted at github.com. The application lets you create users with a profile photo. When you upload the photo, the web application stores it on Amazon S3 instead of your local file system. (Very important if you host...