class

foo and _foo - about variables inside a class

class ClassName(object): """ """ def __init__(self, foo, bar): """ """ self.foo = foo # read-write property self.bar = bar # simple attribute def _set_foo(self, value): self._foo = value def _get_foo(self): return self._foo foo = property(_get_foo, _set_foo) ...

Coming from a class diagram to a dialog window

Hello, I have a class diagram ("Customer") with some private and public attributes as well as some operations. Now I want to model a dialog (GUI) for editing this customer. The window represents the class Customer and some drop downs and checkboxes the attributes. The operations ("save", "refresh") are represented by buttons. Design Qu...

Why is this Python class copying another class contents?

Hello guys. I'm trying to understand an estrange behavior in Python. I have the next python code: class IntContainer: listOfInts = [] def __init__(self, initListOfInts): for i in initListOfInts: self.listOfInts.append(i) def printInts(self): print self.listOfInts if __name__ == "__main__":...

How to get number of attributes in a java class?

I have a java class containing all the columns of a database table as attributes (member variables) and corresponding getters and setters. I want to have a method in this class called getColumnCount() that returns the number of columns (i.e. the number of attributes in the class)? How would I implement this without hardcoding the numbe...

How to access the stage from an AS3 class in Adobe Flash

The problem I've encountered is that I am using a keyboardEventListener to make a movieclip run around. As I'm a college student, I'm creating this for an assignment but we are forced to use as3 classes. When I run the code in the maintimeline, there is no problem. But when I try to access it from another class (with an 'Export for Acti...

Class Declaration in C++

What does it mean when a class is declared like this: class CP_EXPORT CP_Window : public CP_Window_Imp What is the CP_EXPORT portion? What does it mean/imply? ...

Java: Easy way to get method stub out of class files within a JAR file? Reflection?

Hi, I'm searching for a way to get a list of method stubs of all classes within a jar file. I'm not sure where to start... May I use Reflection or Javassist or some other tools of which I've not heard yet!? At least it may be possible to unpack the jar, decompile the class files and scan with a line parser for methods, but I think that ...

Error in writing a class.

I am running through a tutorial online at http://www.sthurlow.com/python/lesson08/ and I believe I understand how classes work in python, at least to some degree but when I run this code: class Shape: def __init__(self,x,y): self.x = x self.y = y description = "This shape has not been described yet" author = ...

store in a variable only the first or only the second class of an element

I'm using this bit of jQ to add a class to two different elements based on the class of another (parent/grandparent, etc) element: $(document).ready(function(){ var containerClass = $('#main-content').attr('class'); $('#nav-primary li#'+containerClass).addClass('active'); $('#aux-left div[id$='+containerClass+']').addClass('...

Ruby is already using the class name of my model

I'm making a forum application with various levels of authorization, one of which is a Monitor. I am doing this by extending my User class, and I plan on fine tuning this with "-ship" classes (e.g. administratorship, authorship, moderatorship, etc.). Apparently the Monitor class is part of ruby mixin. How do I keep my resource name wi...

What Could be the example scenarios to declare any class or any method as "final"?

What Could be the example scenarios to declare any class or any method as "final"? When do we need to do this? Please give me some example to understand the practical use of "final"... please elaborate your answer.... please guide me as I am a beginner in OOP ...

Equivalence of PHP includes in Iphone dev ?

Hey guys, I just noticed I get a lot of redondant code from one class to another in my project (like menus or buttons) ;) Is there any way to optimize it ? Thank you ! Gotye. ...

Dynamic class creation

Is is possible in runtime create class from DataTable where ColumnName will be dynamic class properties? ...

Could someone critique my PHP register/validation classes?

http://pastie.org/931617 is a link to the source code. If there is a better way to do this, let me know. One thing I'm unsure about, is the way I handle child/parent constructs in the validation classes towards the bottom. Thanks. Ok, I took your advice using an associative array. Now, I just toss the $_POST variable to my construct...

Is there a common method for implementing pagination through PHP data objects?

I am going to be implementing a small custom CMS for a website. I was wondering if there are any more popular methods for implementing pagination using OOP. Thanks! ...

convert a sql statement to class?

Is there a tool or code to convert a sql statement to class? Something like: Dim sqlText = "SELECT CustomerID, Name, Address, City FROM dbo.Customer WHERE CustomerID = 1" Dim obj As New ***SqlStatementTool***(sqlText) obj.GetTables() 'Will Return Tables in sqlText obj.GetWheres() 'Will Return conditions in sqltext obj.GetParameters() ...

Problem with inherited classes in C#

I have a class called "Entity," with two child classes: "Creature" and "Item." (I'm making a game.) Creature has two functions called "Attack," one for attacking Creatures, and one for attacking Items. So far, everything works well. Now I'm working on the shooting bit, so I have a function called SelectTarget(). It takes all of the Enti...

Initializing PHP class property declarations with simple expressions yields syntax error

According to the PHP docs, one can initialize properties in classes with the following restriction: "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated." I'm trying...

PHP Classes Extend

I have two classes that work seperate from another, but they extend the same class. Is it possible to have them work the same instance of the extended class. I'm wanting the constructor of the extended class to run only once. I know this isn't right but something like this: <?php $oApp = new app; class a extends $oApp {} class b extend...

How to implement this feature in javascript ? Make uncertain , divorce, the wife say!

In the Javascript, could I define a class, the class itself can also when a function call, similar to the index, such as: function A() { } var a=new A(); var v=a(); //Use ordinary/like Javascript function use ...