class

Loading a class into a function ?

I`m currently working on a script, and I have the following situation. function somnicefunction() { require 'someexternalclass.php'; $somevar = new SomeExternalClass(); } For some reason, the above breaks the function. I'm not sure why, I haven't seen much documentation in php.net regarding this, plus google returned no real r...

Mutual class instances in C++

Hi guys. What is the issue with this code? Here we have two files: classA.h and classB.h classA.h: #ifndef _class_a_h_ #define _class_a_h_ #include "classB.h" class B; //???? class A { public: A() { ptr_b = new B(); //???? } virtual ~A() { if(ptr_b) delete ptr_b; //???? num_a = 0; ...

How to avoid using the same identifier for Class Names and Property Names?

Here are a few example of classes and properties sharing the same identifier: public Coordinates Coordinates { get; set; } public Country Country { get; set; } public Article Article { get; set; } public Color Color { get; set; } public Address Address { get; set; } public Category Category { get; set; } This problem occurs more frequ...

I want to call a class object, being the class name a given parameter

Hi, I want to do something like this: (in php) $a = "class_name1"; $b = "class_name2"; $object1 = new $a; $object2 = new $b is this possible? thank you very much for your time ...

Java declarations (ordering)

In Java, what's generally the most accepted way to organize a class in terms of the order in which declared data members and methods should be listed in the class file, keeping in mind the following and anything else you can think of for each one: its visibility whether it's a constructor, method, or member if it's a method, does it ov...

Database access through collections

Hi All, I have an 3 tiered application where I need to get database results and populated the UI. I have a MessagesCollection class that deals with messages. I load my user from the database. On the instantiation of a user (ie. new User()), a MessageCollection Messages = new MessageCollection(this) is performed. Message collection accep...

Nested class - calling the nested class from the parent class

I have a class whereby a method calls a nested class. I want to access the parent class properties from within the nested class. public class ParentClass { private x; private y; private z; something.something = new ChildClass(); public class ChildClass { // need to get x, y and z; } } How do I acc...

C++ instantiating a class within a method, then altering member variables from a different method?

Say I have a method, and within that method it instantiates a Person class: void methodA() { Person personObject; } How would I access that object's methods from within another method? I.e. something like: void methodB() { personObject.someMethod(); } I realise it's a painfully nooby question :P ...

OOP: how much program logic should be encapsulated within related objects/classes as methods?

I have a simple program which can have an admin user or just a normal user. The program also has two classes: for UserAccount and AdminAccount. The things an admin will need to do (use cases) include Add_Account, Remove_Account, and so on. My question is, should I try to encapsulate these use-cases into the objects? Only someone who is...

What's the difference between entity and class?

Is entity an instance of class? ...

Java/BlackBerry build error overriding too many classes

Hey everyone, Has anyone ever heard of overriding too many classes in Java? Perhaps this issue is just related to BlackBerry development, but I was wondering if it is an issue in Java, too. Let's say I have the following: LabelField lblTitle = new LabelField(title) { protected void paint(Graphics graphics) { graphics.setCo...

PHP: Class to parse OGG and .ogv files?

I am looking for a php class that can parse ogg and .ogv files so that I can get some of the metadata out of the files, such as comments, bitrate, length, etc. I have found this: http://opensource.grisambre.net/ogg/ but after testing it, it does not seem to parse and of the files that I test it with. Has anyone had luck with an alterna...

Using CSS Classes for individual effects - opinions?

Hey, Just trying to canvas some opinions here. I was wondering how people go about adding individual effects to html elements. Take this example: you have three types of h1 titles all the same size but some are black some are gold and some are white. Some have a text-shadow etc. Would you create separate CSS classes and add them do the...

Class to manage e-mail from iPhone

I'm working on an iPhone app that offers the user the opportunity to send an e-mail in 3 different places in the app, and for 3 different purposes. Rather than put the same code for showing the e-mail composer in 3 different view controllers, shouldn't I develop a separate E-mail class, create an instance, and then set properties such a...

Tips about a good class-structure for website? (php)

Hello I'm creating a kind of massive network for users to register and login. I want to try using classes, but I've never used them (expect some mysql-wrappers etc). Could you provide some tips and sample-structure for my project? The idea is to simply have a index.php, which prints the whole page and does all the action. Index.php cal...

Is there a way to generate a UML class diagram from an existing MySQL database?

Was just wondering if there was any software out there to do this? The storage engine is InnoDB so the foreign keys are in place to connect the tables up in the diagram (if such software even exists). ...

what is the underlying data structure of a set c++?

I would like to know how a set is implemented in C++. If I were to implement my own set container without using the STL provided container, what would be the best way to go about this task? I understand STL sets are based on the abstract data structure of a binary search tree. So what is the underlying data structure? An array? Also, h...

What design pattern will you choose ?

I want to design a class, which contains a procedure to achieve a goal. And it must follow some order to make sure the last method, let's say "ExecuteIt", to behave correctly. in such a case, what design patter will you use ? which can make sure that the user must call the public method according some ordering. If you really don't know ...

Beginner having a problem with classes

I'm working through O'Reilly's "Learning Python" and having a problem with classes. I think I understand the concept, but in practice have stumbled upon this problem. Fron page 88-89: >>> class Worker: def __innit__(self, name, pay): self.name=name self.pay=pay def lastName(self): return self.name.split()[-1] de...

How to Load In Content with jQuery?

Hello, I am trying to add ajax functionality to my pagination so the content loads in the same page instead of the user having to navigate to another page when clicking the page links. I should mention that I am using this php pagination class. Being new to jquery, I am unsure of how to properly do this with the pagination class. Thi...