class

Why should/shouldn't I use the "new" operator to instantiate a class, and why?

I understand that this may be construed as one of those "what's your preference" questions, but I really want to know why you would choose one of the following methods over the other. Suppose you had a super complex class, such as: class CDoSomthing { public: CDoSomthing::CDoSomthing(char *sUserName, char *sPassword) ...

Whats best practice for including external actionscript files in flex application

If I include a an external actionscript file in a flex mxml file, I get different behaviours at compile time depending on the method used. Using an mx script tag with a source attribute or an include statement, then compiling the file gives errors like: Error: Packages cannot be nested. If use import these errors go away and the file ...

What Visio Alternatives For The Mac Are There?

I needs a mac compatible UML diagramming application, and on the cheap is better. I've tried Gliffy.com as an online application, but I need something for offline use as well. Any suggestions would be great. ...

Is there a way to decode html e-mails?

I am writing support software and I figured for highlighting stuff it would be great to have HTML support. Looking at Outlooks "HTML" I want to crawl up into the fetal position and cry! Is there a php class to unscramble HTML emails to support basic HTML? I don't want to display the E-Mails in a frame because I want to work with the da...

Linking classes in Geany

I am writing a CLI application for Linux in Geany (a C++ IDE). I want to link a simple config file reader class so it can be used in my program. Just including it doesn't work, I get undefined reference errors. I know how to do this in Dev-C++ on Windows, but not Geany. Thanks for helping! ...

Which would make a Class file bigger? import java.awt.*, or a bunch or single import statements?

Okay, so if I had a project that used: import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.Font; import java.awt.Color; import java.awt.Polygon; Would it make the Class file smaller to use: import java.awt.* I'm thinking against it because I'm importing a lot of things I don't need. I'm ...

Is it possible to obtain class summary at runtime?

Hi. Is it possible to obtain class summary at runtime in C#? I would like to obtain class summary through reflection and then write it to console. By class summary I mean summary comments before class definition, something like this: /// <summary> /// some description /// </summary> class SomeClass { } I don't know if these comments ...

When is it best to use a new class rather than add to an existing class

I have a class called Player in the business layer of my web application. Player class has fields PlayerID, CategoryID and CountryID A function in Player Class calls a function in PlayerDB Class in the Data Access Layer which in turn calls a stored proc which returns data for PlayerID, CategoryID (foreign key to Category table) and Cou...

Tips on proper classes

Hello, I'm using C#. I have a products class with fields like sku, name, description.... and methods like setSku, setDescription, setImages(products have an image attached). I was keeping these methods inside the Product class but because of the large amount of settings available to the client on how to set the sku and descriptions and ...

Creating a Class Library in VB.NET

Hi Everyone. I need to create a class library in VB.NET that will connect to an Oracle database. I would then be executing some functions to retrieve informations from a database. I would then need to utilize this class in ASP.Net 2.0 project. Would someone care to point me in the right direction in achieving this? Thanks. ...

How can I use C++ class in Python?

I have implemented a class in C++. I want to use it with Python. Please suggest step by step method and elaborate each step. Somthing like this... class Test{ private: int n; public: Test(int k){ n=k; } void setInt(int k){ n = k; } int getInt(){ ...

How to create a WMI property dynamically?

Hey, I want to create properties dynamically, when the user retrieves the instances of my class. Implementation in c++, but Put can't create properties on the fly. Can someone point me to the function(s) I need to use to "fill" a empty class on the fly with properties and values. Ciao Ephraim ...

Generics question (Type parameters vs Constructors)

If you have a custom collection class that stores the weights of a single class of fruits individually in floats/double, like so: 1.1, 3.3, 6.6, 4.4, ... and you would need to specify whether it's float or double and to differentiate the fruit type, is it better to do it like this: Using an enum: FruitList<float, FruitType.Orange> ...

Why can't I store a PHP class instance as a SESSION variable

I have a PHP script that is called in 2 ways from a Dojo Ajax xhrGet call. The first time it is called with an "init" argument which causes the script to create an instance of the StateList class and read in a file of state names. session_start(); @include('StateList.php'); require_once('phplog.php'); //start executing here $comd=$_GET...

Inherit from a class or an abstract class

If you have several classes where you want them to inherit from a base class for common functionality, should you implement the base class using a class or an abstract class? ...

Abstract vs real class inheritance in C#

I am wondering if there are any differences to derived classes when using abstract vs real classes for inheritance? It looks to me like the real class inheritance creates an hierarchy whereas abstract class inheritance is just copy-paste code for the compiler to derived classes? Does the abstract class creates a hierarchy? Can it be ac...

How to use self class method on iPhone? (conceptual question)

I write an instance method in ClassName.m: -(void)methodName:(paraType)parameter {...} And call it using [self methodName:parameter]; A warning will pop up, but the code still runs successfully. Is this because I haven't created an instance of the class? Why the method still runs normally? And what is the correct way to call self meth...

How to pass string parameter of a method from one class to another class in same namespace?

Hi Friends, Little silly question, but got stuck for a long time. I have written two classes one which is a Form (TreeDisplay class) and other which contains buiseness logic (MyTreeNode class). TreeDisplay class contains browse button to select a file pass it to a method initiatingTree(string filename) which is in MyTreeNode class. No...

C# - how enumerate all classes with custom class attribute?

Question based on MSDN example: http://msdn.microsoft.com/en-us/library/aa288454(VS.71).aspx Let's say we have some C# classes with HelpAttribute in standalone desktop application. Is it possible to enumerate all classes with such attribute? Does it make sense to recognize classes this way? Custom attribute would be used to list possibl...

Struct vs Class for long lived objects

When you need to have very small objects, say that contains 2 float property, and you will have millions of them that aren't gonna be "destroyed" right away, are structs a better choice or classes? Like in xna as a library, there are point3s, etc as structs but if you need to hold onto those values for a long time, would it pose a perfo...