class

Class name for unix-like permission object

I have a class to store unix-like permissions for user, group and other. In principle it is a limited access control list but I don't want to name it ACL, because usually an ACL is something different. The class looks basically like this: class X { boolean userRead, userWrite, userExecute; boolean groupRead, groupWrite, groupExecut...

php class extends - attributes/methods with same name ok?

If you have a class named "User" and another class named "Admin" that extends "User", and you want Admin to inherit all attributes,methods from User, except for the __construct method, for example. class User { private $name; function __construct($name) { $this->name = $name; } } and class Admin extends User { private $authorization...

which method is more efficient: set a class property; or return the result?

Please consider this example. (PHP) class Database{ private $result; private $conn; function query($sql){ $result = $this->conn->query($sql); // Set the Database::$result ?? Or return the value and avoid setting property? return $result; // $this->result = $result; } } wha...

How to access string value from new class that inherit string type

I want to define a new class that inherit the build in str type, and create a method that duplicates the string contents. How do I get access to the string value assigned to the object of my new class ? class str_usr(str): def __new__(cls, arg): return str.__new__(cls, arg) def dub(self): # H...

How to add several classes to ul list

How can I add severeal classes to ul list? I dont want to add it to every li items but jsut some of them. ...

How to store the object data in mysql db using php class function?

Hello! I have created a table in DB with name "member" having field "name", "college", "email", "zid" now I have created a class(in php) like class member { private $name,$college,$email,$zid; private function adduser { //function definition } public function autherise($id) { //function definition } } now at index page...

Class Inheritance through Multiple Classes

Hello, I have 3 classes and I run the first class and declare a variable in the second class and want the 3rd class to be able to print out this variable. I have code below to explain this more clearly. from class2 import Class2 class Class1(Class2): def __init__(self): self.value1 = 10 self.value2 = 20 def a...

Is it possible to define a wx.Panel as a class in Python?

I want to define several plugins. They all inherit from the superclass Plugin. Each plugin consists on a wx.Panel that have a more specific method called "draw". How can I define a class as a Panel and afterwards call that class in my frame? I've tried like this: class Panel(wx.Panel): def __init__(self, parent): wx.Panel...

Static Methods vs Class Instances and return values in C#

I have various classes for handling form data and querying a database. I need some advice on reducing the amount of code I write from site to site. The following code is for handling a form posted via ajax to the server. It simply instantiates a Form class, validates the data and processes any errors: public static string submit(Dicti...

Having a problem with PHP property_exists()

Hey all... When I run the code below, the if(property_exists(get_class($puzzleCharacters_encrypted), $solutionCharacter) keeps evaluating to false, but the echo statements preceding that are showing the correct information, so the properties are definitely there. Anything I might be missing? (PHP Version 5.2.11) $puzzle_solution = $curr...

php class function -> call the function according to a passing parameter

Hi, I have a class 'abc', with several functions inside it: 'abc_function1' 'abc_function2' 'abc_function3' 'abc_function4' 'abc_function5' I would like to call a function of the class 'abc' according to a parameter that I enter, a string containing 'function1' or 'function 4' for example, to refer to the corresponding function of the ...

Invalid use of incomplete type on g++

I have two classes that depend on each other: class Foo; //forward declaration template <typename T> class Bar { public: Foo* foo_ptr; void DoSomething() { foo_ptr->DoSomething(); } }; class Foo { public: Bar<Foo>* bar_ptr; void DoSomething() { bar_ptr->DoSomething(); } }; When I compile it in...

C++ Inserting a class into a map container

I have a map in C++ and I wish to input my class as the value, and a string as the key. When I try to, I get an error 'Scene_Branding' : illegal use of this type as an expression I get an illegal use of this type as an expression, and I can't seem to find out why. Here is some code. string CurrentScene = "Scene_Branding"; map<string, ...

Better way to work with the UPS API?

Specifically, the UPS TradeAbility API -- I'm trying to implement Denied Party screening into my lead processing/quotation web application. However, the TradeAbility API is a bear. I've found some decent package classes for simple tracking, which I've implemented successfully. But I've seen nothing to support TradeAbility. UPS-PHP has i...

Class definition and memory allocation

If definition stands for assigning memory. How come a class definition in C++ has no memory assigned until an object is instantiated. ...

updating properties of a class with dynamic references

Sorry for what is probably a very basic question. I have a vb.net class with properties defined as follows: Private m_Property1 As String Public Property Property1() As String Get Return m_Property1 End Get Set(ByVal value As String) If IsNothing(value) Then m_Prop...

Why should I use classes rather than just a collection of functions?

Possible Duplicate: What are the benefits of OO programming? Will it help me write better code? OO PHP Explanation for a braindead n00b Just started learning/playing with creating classes in PHP and I'm wondering what pain do they solve? It seems like I can get the same job done with just a collection of functions that I inclu...

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...

Delphi, VirtualStringTree - classes (objects) instead of records

I need to use a class instead of record for VirtualStringTree node. Should I declare it standard (but in this case - tricky) way like that: PNode = ^TNode; TNode = record obj: TMyObject; end; //.. var fNd: PNode; begin fNd:= vstTree.getNodeData(vstTree.AddChild(nil)); fNd.obj:= TMyObject.Create; //.. or should I use directly TMyOb...

iPhone: Warning in Cyclic import in MKAnnotation: method not found

I just resolved a cyclic dependency problem by using class forwarding. Now, I am getting a warning of no 'showSumDetails' method found. I don't understand why it should happen at all, any help will be appreciated. Including a bit of code here: MyAnnotation.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> //#import "MyMapVi...