class

ASP.NET Pass Error Messages

This is probably going to end up as a stupid question, but countless research has offered me no results. I know there are different types of errors I want to check for, and when I should be throwing an exception for "exceptional" errors, and that I should create validating functions for input and other checks. My problem is, how do I...

How to compare two objects (the calling object and the parameter) in a class?

Hello, I am writing a "Date" class for an assignment and I am having trouble doing one the of the functions. This is the header file for the class. class Date { public: Date(); // Constructor without parameters Date(int m, int d, int y); // Constructor with parameters. // accessors int GetMonth(); ...

How to document class properties in PHP 5 with phpDocumentor

Take in consideration the following PHP 5 class: class SomeClass { //I want to document this property... private $foo; function __construct() { } public function SetFoo($value) { $this->foo = $value; } public function GetFoo() { return $this->foo; } } How in phpDocumento...

#include confusion and classes

I have been making several games with the Allegro API and C++. I have also been putting all my classes in 1 big main.cpp file. I tried many times to make .h and .cpp files, but my big problem is I have trouble with #including at the right place. For example, I want all my classes to access the allegro library without #including allegro.h...

Can I make a protected member public in Java? I want to access it from a subclass

Hi, I'm new to Java and OOP, I was using a private subclass (actually a struct) B in a class A, and everything went well until I decided to make a parent class C for subclass B. I want make public some of the protected members of class C. For example: public class A { private class B extends C { public int product; ...

java inner/outer class questions about outer class private variables access

Hi, I have the following java class: class Outer { private Integer a; private Long b; class Inner { public void foo() { System.out.println("a and b are " + a + " " + b); } } } when I run javap on Outer and Outer$Inner, I get the following: C:\test>javap Outer Compiled from "Ou...

How do I factorize a parameters repeats several times in my class?

Hello, I show you firsly my class : as you can see I repeated several times $versionId param because all the method needs it. I am asking myself if there is a way to factorize it so there is lesser repetition. <?php class Admin_Model_Version { private $_db; private $_versionId; private $_path; public function __construct() {...

How to create Visual Studio style class diagram in Visio?

I need to plan out a Class, Method, Attribute style diagram, I have looked at the Class Designer in Visual Studio, but it seems to not do what I want. I want to be able to have a diagram show the classes just like in Visual Studio - except I want to be able to represent the parameters these methods require, for example: getStock(StockID...

declare property as object?

how do you declare a class property as a object? i tried: public $objectname = new $Object(); but it didnt work. and why should you do it like this that? isn't it better to just instantiate that object and just use its members? ...

could static members use nonstatic members and vice versa?

could i use nonstatic members inside a static method? eg. $this->nonStaticProperty $this->nonStaticMethod() and vice versa that is to say use static members inside non-static methods? ...

How do I iterate through the Attributes of a C# class (.NET 2.0)?

Say I have a class: public class TestClass { public String Str1; public String Str2; private String Str3; public String Str4 { get { return Str3; } } public TestClass() { Str1 = Str2 = Str 3 = "Test String"; } } Is there a way (C# .NET 2) to iterate through the Class 'TestClass' and print out public variables and a...

Event.observe function - observe element by class instead of id

There is prototype js function: Event.observe(element, eventName, handler) here the element means element's ID. Is it possible to put here element's class? I got this element from third party with class attribute only. ...

can we create the object of inner class in the constructor of outer class?

Can we create the object of inner class in the constructor of outer class? ...

How can I monitor the opened URLs via java.net.URL class in a Java program?

Hi all, I am working on a big (lots of classes) java project and I have it's source code but most of the classes are dynamically created or downloaded via ClassLoaders. Anyways, I'd like to be able to "override" the java.net.URL class so I could trace down the calls to open a url. I can not use a sniffer because the content is SSL encryp...

Java: Is the following a class or an object?

public class Animal { public Animal() { System.out.println("Animal"); } } public class Mammal extends Animal { public Mammal() { System.out.println("Mammal"); } } Is this an object or a class? If not, what would be an example of an Object? ...

How to structure a project in Visual C++ 2008 Express

I am using Visual C++ 2008 Express for the first time for a project. And I can't seem to be able to split the .h & .cpp files for classes I'm writing. I was under the impression that you add a header file and prototype the class in there, and then you add a .cpp file with the implementation into your source files directory. Then when ...

Why don't all Java classes have interfaces?

I got this question for homework, and I'm not sure how to answer it. Could you help me out? :) ...

What are 3 possible situations in which static methods might be included in classes?

I got this question for homework, and all I can think of is to return a subclass of an abstract superclass. Thanks! ...

using require inside a class

i want to make a "loader class" that will require selected files. so i just can call eg. loader::load('systemLibraries, 'applicationLibraries'). so inside this load() method i will use require. but i have tried this and it seems that the files required can't be used outside the class. how can i make it globally accessed? ...

Getting name of the class from an instance

Hi everyone I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. Any guess how to get this? Thank you very much! ...