class

Flex: Accessing MXML from class

I have a class that I instantiate at creation complete: public var catalog : AppCollection = new AppCollection (catalogStrip); CatalogStrip is an HBox. In this class, I create a VBox and add it as a child to catalogStrip. Here is the constructor for said class: public function AppCollection (_container : HBox) { this.container =...

Circle functions not behaving as expected in Java Class

so i made a circle class that sets the radius, and should output the radius, circumference and area however, if i input the radius, the radius, circumference, area wont output back, it just shows as 0.0 heres my Circle.java public class Circle { private double radius; private double PI = 3.14159; public void setRadius(doubl...

Why won't a derived class work in an array? (C++)

I've created a class, called vir, with a function move: class vir { public: vir(int a,int b,char s){x=a;y=b;sym=s;} void move(){} }; (It's derived from a class with variables int x, int y, and char sym) I have derived a class from this, called subvir: class subvir:public vir { public: subvir(int a,int b,char s){x=a;y=b...

C++ how to call a parent class method from contained class?

I am trying to make a call to a Parent class method from a contained object, but have no luck with the following code. What is the standard way to do it? I have searched around and this seems to work for inherited objects, but not for contained objects. Is it right to call it a Parent class even? Or is it called an Owner class? class P...

PHP show names of all declared classes?

Lets say I have this code: <?php class hello { var $greeting = "hello"; function hello(){ echo $this->greeting; return; } } $hello1 = new hello; $hello2 = new hello; $hello4 = new hello; ?> How do I get it to echo all the names of instantiated objects (and if possible their respective class), so that it ec...

Accessing private instance variables of parent from child class?

Let's say we have a class foo which has a private instance variable bar. Now let us have another class, baz, which extends foo. Can non-static methods in baz access foo's variable bar if there is no accessor method defined in foo? I'm working in Java, by the way. ...

PHP Class Name Conflict

I'm attempting to mix a PHP REST framework (Recess) with an webapp building framework (VCL4PHP), they unfortunately like to name their classes the same. Cache, Application (probably others, but I gave up at Application). Are there namespaces in PHP or any way I can get around this without rewriting one or the other frameworks or am I S...

Java methods and classes, how do they fit together? (Solved)

Currently I am writing a program for an introductory Java class. I have two pieces to my puzzle. Hopefully this is a relatively simple to answer question. Firstly, here is what I am trying to use as my main program: import java.util.Scanner; public class TheATMGame { public static void main(String[] args){ Scanner input = new S...

PHP Class construct with three optional parameters but one required?

So basically I understand this ... class User { function __construct($id) {} } $u = new User(); // PHP would NOT allow this I want to be able to do a user look up with any of the following parameters, but at least one is required, while keeping the default error handling PHP provides if no parameter is passed ... class User { ...

Should we go open-source?

Recently, we've release first stable version of our API access for developers(main features of main product). Our API now has about 4 features with their own signatures, response types and so on. To increase its popularity we want to release Wrapper Class for this functions in the most popular programming languages. So now we have to ...

Can you create class properties dynamically in PHP ?

Is there any way to create all class properties dynamically ? For example I would like to be able to generate all class attributes from the constructor and still be able to access them after the class is instantiated like this: $class->property. To be more specific, when I'm dealing with classes that have a large number of attributes I ...

c++ accidental static

I've got a linked list class and for some reason when I increment an int in one object e.g linked1.size for some reason linked2.size also increments! And ideas why this is? I didn't intentionally make it a static variable. my code: main() { Vlist v1; v1.add(1,0); v1.add(2,0); Vlist v2; } Incrementing the size member vari...

PHP: 'Dynamic' callback from inside/outside a class

Hi guys, we have a problem [cit.] I need to assign a callback dynamically within a class, in base of a variable param: my goal is to have just one class (and not a main class and many extender sub-class), and inside this class if a value is X, then the funcitonX must be used, if is Y, the functionY. I know i cant explain well, i hope m...

Call a method in the initiator class from the instantiated class obj-c

I have a button class - when the button is clicked, the playFile method of the MyAudio class is called. So my question is, its trivial to call the playFile method from the button class, but how do I call the method displayStopButton from the initiator class? button class - (void)myButtonClicked: (id)sender { [MyAudio playFile]; } ...

Advantage of Static class over use of Singleton

Duplicate What’s wrong with singleton? Singletons: good design or a crutch? Singleton: How should it be used What is so bad about Singletons You can find numerous reasons for using a Singleton over a Static class. But there must surely be some situations where it is better to use a static class before a Singleton. What ar...

Java: Is a class a subclass of itself?

A class can be a "subclass" of itself if its inner class extend the outer class so the class is somehow extending itself without throwing any Exception. So, does it really mean a class is also a subclass of itself? Thanks. ...

What's the optimum size for a class file?

I know that there is no single "ideal" size of a class file, but still... Are there any data (like studies, not like opinion) on what is the optimum size for a class file? ...

Where is the class view for a code behind file in VS 2005

I can't seem to find any of my code behind files in the class view tab. I can see other classes that I have added but none of the code behind files. Is there a reason for this? I am missing a setting or something? It is quite irritating trying to navigate my way through the code all the time. I can see all the other classes just fine ju...

When should I use enhanced record types in Delphi instead of classes?

Delphi 2006 introduced new capabilities for records, making them more 'object-oriented'. In which situations is the record type more appropriate for a design than a class type? Which advantage does it have to use these record types? ...

RollBack or Commit (Enterprise Library Transaction) over classes when other class get result in C#

I have a class which is mirror of table. public class Patient { public int Patient_id { get; set; } public string Name { get; set; } public string Address { get; set; } public bool Sex { get; set; } public Patient f_UpdatePatient(Patient _patient) { string QUpdate = " ...