class

How can I access a method from another class?

Hey, I know this question was already ask several times but i don't get it. I have 2 classes classA.h & .m and classB.h and .m. In classA.h i've got a UITextField *myTextfield. In classB i import the header of classA and define the class with @class classA. I also set classA *classa. if i try to get the value of myTextfield like this...

Setting the Page-Title in .Net using C# from a Class

Question, How do i set the title of a page from a class. Is it even possible? I can and have set the page title from a page itself and a usercontrol. Can I, How Do I do this via a class using C# .Net Here is what im looking to do, From the Aspx Page i want to call a function that passes in the string title, and have the class set th...

How to use a method from a class in another class without extending

Sorry if my question sounds weird lol I'll try to explain. I have 4 classes: Karakter, Karakters, Orc, Human. Orc and Human both extend Karakter. Karakters is an ArrayList with Karakter in it. I have a method in both Orc and Human called: public String getRace(). Now I want to use this method in Karakters?!! When I try to do this, it ...

Splitting templated C++ classes into .hpp/.cpp files - is it possible?

g++ -c -o main.o main.cpp g++ -c -o stack.o stack.cpp g++ -o main main.o stack.o main.o: In function `main': main.cpp:(.text+0xe): undefined reference to 'stack::stack()' main.cpp:(.text+0x1c): undefined reference to 'stack::~stack()' collect2: ld returned 1 exit status make: *** [program] Error 1 stack.hpp: #ifndef _STACK_HPP #defin...

Referencing classes in Python

Hi all I'm having a spot of bother with Python (using for app engine). I'm fairly new to it (more used to Java), but I had been enjoying....until now. The following won't work! class SomeClass(db.Model): item = db.ReferenceProperty(AnotherClass) class AnotherClass(db.Model): otherItem = db.ReferenceProperty(SomeClass) As far as...

PHP Calling a function within a Class method?

I have been trying to figure out how to go about doing this but I am not quite sure how. Here is an example of what I am trying to do: class test { public newTest(){ function bigTest(){ //Big Test Here } function smallTest(){ //Small Test Here } } publ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I'd like to serialize this to JSON and send it to (for example) a JavaScript page, which would convert the JSON string back into objects. But it should then...

Template Classes in C++ ... a required skill set?

I'm new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly? ...

Creating (boxed) primitive instance when the class is known

I need a method that returns an instance of the supplied class type. Let's assume that the supplied types are limited to such that an "empty" instance of them can be created. For instance, supplying String.class would return an empty String, supplying an Integer.class would return an Integer whose initial value is zero, and so on. But ho...

Class keyword in Javascript

According to this article it should be a Javascript 2.0 way to define class. However, I never saw that in practice. Thus the question. How to use class keyword and what is the difference between Javascript 1.x way of doing things? ...

Using a non-static class member inside a comparison function

Hello everyone, I'm currently developing a syntaxic analyser class that needs, at a point of the code, to sort structs holding info about operators. Each operator has a priority, which is user-defined through public member functions of my analyser class. Thus, when sorting, I need my sorting function to order elements based on the prior...

C# - Expose a Static Class inside a normal class?

Here is an easy example: ASP.NET provides several static classes based around the membership provider. We are forever using them in our pages. We also have a need to extend the base System.Web.UI.Page class. So, one thought we had was to expose the various static classes in our OurCompany.Web.UI.Page implementation. We cannot use a ...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes this How to do this? ...

What is the reason for the entire C++ STL code to be included in the .h rather than .cpp/.c files?

I just downloaded the STL source code and I noticed all the definition for the STL template classes are included in the .h file. The actual source code for the function definition is in the .h file rather than .cpp/.c file. What is the reason for this? http://www.sgi.com/tech/stl/download.html ...

Pass functions to a class

PHP mysql database I have created a follow on question to this one here that is specifically about pagination I need to call a method from one class in another, and be able to change the method that is called. Like so class db{ function a(){ echo 'I run a query';} function b(){ echo 'im the other query';} } class YourClass...

asp.net cookie from a resource project (+ a general info)

i'd like to use a class to manage a certain cookie, but not directly on the page where i have access to all the httpcookie stuff like so HttpContext.Current.Request.Cookies["CookieName"].Value;. however i'd like to be able to do this from a class in another project. i have a reference to that project and can access the class, but there ...

Using classes with the Arduino

I'm trying to use class objects with the Arduino but keep running into problems. All I want to do is declare a class and create an object of that class. Can anyone give me an example? ...

C++ new operator. Creating a new instance

I'm having some trouble creating an object in C++. I create a class called Instruction, and I am trying to create a new instance, but I get compiler errors. Class code: class Instruction{ protected: string name; int value; public: Instruction(string _name, int _value); ~Instruction(); void setName(string _name...

What are the different objects in this situation?

A group diary and time management system is intended to support the timetabling of meetings and appointments across a group of coworkers. When an appointment is to be made that involves a number of people, the system finds a common slot in each of their diaries and arranges the appointment for that time. If no common slots are available,...

How do I call a method in the default instance of a VB.NET Form instead of instantiating another?

When an instantiated class calls a method in the parent form class, VB.NET starts a new instance of the form class instead of calling the method on to the active one! How do I tell it that I have just one instance of my form class, or that I don't want to create a new instance of the form and just call the method on the already active f...