class

Initialized Variables lose Values after Function Call.

Question says it all, really. I'm not sure what the problem is. I'm fairly new to classes; my practical experience with them being close to nill, but I have read a fair amount about them. I have created a class ECard with the following constructor ECard::ECard( int bankNum, int PIN ) { m_BankNum = new int; m_PIN = ...

Use of Java constructors in persistent entities

Hello I'm new to JPA and using persistence in Java anyway and I have two questions I can't quite work out: I have generated tags as: @JoinColumn(name = "UserName", referencedColumnName = "UserName") @ManyToOne(optional = false) private User userName; @JoinColumn(name = "DatasetNo", referencedColumnName = "DatasetNo") @ManyToOne(optiona...

Object Oriented Programming in AS3

I'm building a game in as3 that has balls moving and bouncing off the walls. When the user clicks an explosion appears and any ball that hits that explosion explodes too. Any ball that then hits that explosion explodes and so on. My question is what would be the best class structure for the balls. I have a level system to control levels...

Create dropdown from multi array + PHP class

Hi there, Well, I am writing class that creates a DOB selection dropdown. I am having figure out the dropdown(), it seems working but not exactly. Code just creates one drop down, and under this dropdown all day, month and year data are in one selection. like: <label> <sup>*</sup>DOB</label> <select name="form_bod_year"> <option value=...

Setting attributes of a class during construction from **kwargs

Python noob here, Currently I'm working with SQLAlchemy, and I have this: from __init__ import Base from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, String from sqlalchemy.orm import relationship class User(Base): __tablename__ = "users" id = Column(Integer, primary_key=True) username ...

Best method to cache objects in PHP?

Hi, I'm currently developing a large site that handles user registrations. A social networking website for argument's sake. However, I've noticed a lag in page loads and deciphered that it is the creation of objects on pages that's slowing things down. For example, I have a Member object, that when instantiated with an ID passed as a c...

question about class derivation in c++?

hi, i want to know some things about class derivation in c++ so i have super class x and an inherited class y and i did this class x{ public:a; private:b; protected:c; } class y:public x{ public:d; } in this case how y can access a,b,and c and by how i mean(public,protected,private) the second case: class x{ ...

Open "Class Explorer" in Visual Studio 2010

Does anyone know where I can open the "Class Explorer" in Visual Studio 2010. I have been looking around for 1 hour :-( ...

Window Wrapper Class C++ (G++)

Hi all, I am attempting to learn about creating windows in c++, I have looked at an article about creating a wrapper class but I don't really understand it. So far I know that you can't have a class method WndProc (I dont know why) but honestly, that is all. Can somebody give an explanation, also explaining the reinterpret_cast? Here is ...

Why isn't this simple test class's method inherited in Ruby?

Consider this very simple logging class: class MockLog # ... end Let's add logging to all our classes: class Module def has_logging() class_eval { @log = MockLog.new def log self.class.instance_variable_get :@log end } end end Now, why doesn't this work? class Foo has_logging end Foo.new.l...

Setting an instanced class property overwrites the property in all instances.

I have two instances of a class. Setting a property in the first instance will set it for the second instance too. Why? It shouldn't. The property is not a "prototype property". Check the code below, what happens to Peter Griffin? Two objects are created and given the name "Peter Griffin" and "Roger Moore" but the alert boxes will say "...

Lua class instance with nested tables

Hello, Simple lua game with simple class like so: creature = class({ name = "MONSTER BADDY!", stats = { power = 10, agility = 10, endurance = 10, filters = {} }, other_things = ... }) creatureA = creature.new() creatureB = creature.new() creatureA.name = "Frank" creatureB.name = "Zappa" creatureA.stats.agility = 20 creatureB.s...

Help required in adding new methods, properties into existing classes dynamically

Hi All, I am not sure whether it is possible to achieve this kind of implementation in Dot Net. Below are the information Currently we are on an application which is done in COM+, ASP, XSL, XML technologies. It is a multi tier architecture application in which COM+ acts as the BAL. The execution steps for any CRUD operation will be def...

Instantiating a class within a class

Hello. I'm trying to instantiate a class within a class, so that the outer class contains the inner class. This is my code: #include <iostream> #include <string> class Inner { private: std::string message; public: Inner(std::string m); void print() const; }; Inner::Inner(std::string m) { message ...

A public struct inside a class

I am new to C++, and let's say I have two classes: Creature and Human: /* creature.h */ class Creature { private: public: struct emotion { /* All emotions are percentages */ char joy; char trust; char fear; char surprise; char sadness; char disgust; char anger; ...

Where do you extend classes in your rails application?

Just about to extend the Array class with the following extension: class Array def shuffle! size.downto(1) { |n| push delete_at(rand(n)) } self end end However, I was wondering where a good place to keep these sort of extensions. I was thinking environment.rb or putting in its own file in the initializers directory. ...

problem with PHP class function ()

hello this is my first question here and i hope you can help me .. I am trying to find a soloution of the towers of hanoi problem by three search ways (BFS-DFS-IDS) so I use "state" class whitch defined by 5 variables as here : class state { var $tower1 = array(); var $tower2 = array(); var $tower3 = array(); var $depth; var $neig...

error C2440: '=' : cannot convert from 'bool' to 'bool *'

I'm getting said error on this line "b = true". Now Why am I getting this error? Aren't I pointing to TurnMeOn and thus saying TurnMeOn = true? class B{ void turnOn(bool *b){b = true} }; int main(){ B *b = new B(); bool turnMeOn = false; b->turnOn(&turnMeOn); cout << "b = " << turnMeOn << endl; } ...

How to override a CSS class within a content div

I want to reimplement the property margin-right in a bloc whitin a content. this is the content id css: #content h2 { margin-right:2px; } this is the bloc class css: .bloc h2 { margin-right:0px; } I want the margin-right bloc works not one the content ...

Is it possible to create a python iterator over pre-defined mutable data?

I might be doing this wrong, if I am, let me know, but I'm curious if the following is possible: I have a class that holds a number of dictionaries, each of which pairs names to a different set of objects of a given class. For example: items = {"ball" : ItemInstance1, "sword" : ItemInstance2} people = {"Jerry" : PersonInstance1, "Bob" ...