class

How to "scan" the full list of currently-installed VCL components

I still haven't found a truly satisfactory answer to this question, and am now considering rolling my own. I have ModelMaker and GExperts, and neither seems to load the comprehensive class-hierarchy I am looking for. As well, I don't think the folks at DevExpress will fork over the CDK code which compiles a full class list to inherit f...

Is it legal to stub the #class method of a Mock object when using RSpec in a Ruby on Rails application?

I would like to stub the #class method of a mock object: describe Letter do before(:each) do @john = mock("John") @john.stub!(:id).and_return(5) @john.stub!(:class).and_return(Person) # is this ok? @john.stub!(:name).and_return("John F.") Person.stub!(:find).and_return(@john) end it.should "have a valid #to fi...

C# - Why can I not cast a List<MyObject> to a class that inherits from List<MyObject>?

Hi All, I've got an object, which I'll call MyObject. It's a class that controls a particular data row. I've then got a collection class, called MyObjectCollection: public class MyObjectCollection : List<MyObject> {} Why can I not do the following: List<MyObject> list = this.DoSomethingHere(); MyObjectCollection collection = (MyObj...

C# class objects

Hello, I have a class that I am using below. And I am using this class for my windows application. However, when I call the method from my application ReadInConfig() it successfully reads and fills the datatable, and assigns the _sip_ip address. In my windows application I have the following. However, it doesn't give me the sip_ip that...

How to properly use structs inside a class?

Using: VS2008, Win32, C/C++ I'm trying to encapsulate my entire dialog window into a class for reusability. Sort of like a custom control. In doing this, I am moving my seperate functions into a class. The following struct design though is giving me problems, with Visual Studio outputting: error C2334 '{'. It's a simple message map ...

Actionscript 2: A class loaded into a parent class, get parent variables

Hello, I have a child class that is loaded into the parent class when the swf begins, like so: var myvar = 'hello'; public function Parent() { this.child = new Child(); }; How can I retrieve the variable 'myvar' from within child? ...

Is there an open source class somewhere for handling user comments?

Hi everyone, I'm just wondering if anyone knows of a class that exists for handling user comments already. I can always write my own, but I figure I wouldn't re-invent the wheel if there is one out there. Id like to be able to display a comment form, manipulate/validate/sanitize user input, and possibly more functions such as inserting...

What is the best way of relating relational database tables into Java classes?

Hello I wonder if anyone can advise me here; I have an application which has classes like this: Code: public class Order implements Serializable { private int orderNo; private int customerNo; private date orderDate; public int getOrderNo () { return orderNo; } public int getCustomerNo () ...

Having 2 variables with the same name in a class that extends another class in Java

Hello everyone. Following is a part of my code for a project: public class Body extends Point{ public double x, y, mass; public Body() { x = y = mass = 0; } public Body(double x, double y, double mass) { this.mass = mass; this.x = x; this.y = y; } } public class Point { public double x; ...

When are class variables loaded?

See the two ways of class definition: //definition: 1 public class MyClass{ private MyObject obj = new MyObject(); private String str = "hello world"; // constructor public MyClass(){ } } // definition: 2 public class MyClass{ private MyObject obj = null; private String str = null; // constructo...

Accessing a member of an object within a class in PHP

My code: class Address{ public var $Street; } class Employee{ public var $ID: public var $Name: public var $Address; } $myEmployee = new Employee(); $myEmployee->Address = new Address(); How do I access the the street now? $street = $myEmployee->$Address->Street; $street = $myEmployee->Address->Street; Both give me...

C++ Header file that declares a class and methods but not members?

Is it possible to make a C++ header file (.h) that declares a class, and its public methods, but does not define the private members in that class? I found a few pages that say you should declare the class and all its members in the header file, then define the methods separately in you cpp file. I ask because I want to have a class th...

How does OOP manage to 'include' classes stored in different files

I'm trying to move into OOP development and am turning to here as I'm sick of searching the web and finding only the very basic information about what classes are and how they can inherit from each other - that I understand. What I don't understand as yet is how all these classes can be stored in different files, doted around a folder s...

Passing arguments to the Class Constructor

How can I pass a arbitrary number of arguments to the class constructor using the Object() function defined below? <?php /* ./index.php */ function Object($object) { static $instance = array(); if (is_file('./' . $object . '.php') === true) { $class = basename($object); if (array_key_exists($class, $instance) =...

Java class question

class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { public Object foo() { return this; } } public Object foo() { return this; } throws a compilation error. Why is that? Can someone explain why "Object" type is not possible? Is Object the base class of C...

Having some trouble getting my classes to work together.

I am working on a simple ruby assignment and I am getting and internal server error. I am assuming it is in how I am tying my classes together. EDIT: I updated it and now I am just not inserting to the database. The point of issue is where I call "result = @dbh.query(query)" This is my first page: #!/usr/local/bin/ruby require 'cgi...

Python Module/Class Variable Bleeding

Okay, it took me a little while to narrow down this problem, but it appears python is doing this one purpose. Can someone explain why this is happening and what I can do to fix this? File: library/testModule.py class testClass: myvars = dict() def __getattr__(self, k): if self.myvars.has_key(k): return sel...

WCF Additional Proxy Classes

I have a WCF webservice that has the following service contract [ServiceContract(Namespace = "http://example.org")] public interface IEquinoxWebservice { [OperationContract] Guid Init(); [OperationContract] List<Message> Dequeue(Guid instanceId); [OperationContract] void Enqueue(Guid instanceId, Message message...

How to get class object's name as a string in Javascript?

Let's say I instantiate an object in Javascript like this: var myObj = new someObject(); Now, is it possible to obtain the var object's name as string 'myObj' from within one of the class methods? Additional details (edited): The reason why I would like to get the name of the variable holding reference to the object is that my new...

ruby: can I have something like Class#inherited that's triggered only after the class definition?

#inherited is called right after the class Foo statement. I want something that'll run only after the end statement that closes the class declaration. Here's some code to exemplify what I need: class Class def inherited m puts "In #inherited for #{m}" end end class Foo puts "In Foo" end puts "I really wanted to have #inherit...