class

Access private elements of object of same class

Is this legal? If not, will the following code allow this? class Foo { friend class Foo; } ...

vb.net PDF integration

We have a database that has decompiled data versions of PDF files stored as blobs. The old method to retrieve the information was to grab the blob, compile the file on the local disk, and then use process.start to launch the new .pdf file that was created. I guess I am looking for a class that can accept the decompile PDF data, turn it...

How does PHP see classes - only in include files?

In PHP are classes only seen when they are in an include file? In Java I can see them in another file without including that file in my current file. In PHP is the only way to see any given class to include it in your file? So I'm just including my class file(s) everywhere? ...

Formal definitions of Classes and Structs

I remember touching on this subject during a class on programming languages. I vaguely remember that a struct could be seen as a mathematical tuple. Is it possible to describe a class or an object in a similar fashion? ...

Using sortUsingSelector on an NSMutableArray

I have used sortUsingSelector to sort an NSMutableArray of custom objects. Now I'm trying to sort an NSMutableArray containing NSMutableArrays of custom objects. Can you use sortUsingSelector on an NSMutableArray, or does it only work for custom classes? ...

Private data types and member functions.

What does it actually mean when you declare a variable or a member function as private in a C++ class? Besides the obvious fact that, these are accessible only by the member functions, How are they mapped differently on memory, than their public counterparts? ...

Read the print values of an imported class

This is probably very basic, but it's giving me a headache, and I'm not sure what method to even approach it with, making the googling tough. If I have a class in a module that I'm importing with various prints throughout, how can I read the prints as they come so that I may output them to a PyQT text label? class Worker(QtCore.QThread...

Disposing of custom Data Access Layer references

Our application uses a custom DataAccessLayer class almost exclusively, and within that we do use Data Access Application Block (currently version 2). We are getting the infamous "GetOrdinal" error sporadically. We are not using out-of-method connections. We are using DAAB version 2. Below is a typical example of our DAL methods: Pu...

C++ singleton vs completely static object

Let say we need to have just one instance of some class in our project. There are couple ways of doing it. I want to compare. Please can you review my understanding. 1) Classical Singleton pattern 2) Completely static class (all methods and members are static). As I understand the differences are following: a) The order of initiali...

Organizing Python classes in modules and/or packages

I like the Java convention of having one public class per file, even if there are sometimes good reasons to put more than one public class into a single file. In my case I have alternative implementations of the same interface. But if I would place them into separate files, I'd have redundant names in the import statements (or misleading...

Passing data between classes in PHP

A couple of questions: q1: IN OOP PHP, what is the best way for a child class to make use of a var set by the parent class, and to set a variable in the parent class. What I want to do is run a function in the child class, that uses one of the variables in the parent class. I have done it by setting the variable I want to access as pu...

Is this the right way to create and call a class for an iphone application?

I have this class loader.h #import <Foundation/Foundation.h> @class Reachability; @interface loader : NSObject { } - (void)startLoading; @end loader.m #import "loader.h" #import "Reachability.h" @implementation loader - (void)startLoading{ NSLog(@"Check network"); } @end Is the code bellow the correct way to include the above c...

How to add methods to a rails polymorphic association?

So, if I have a polymorphic association throughout my application, is there a way to add methods to it? For instance, if :post, :photo and :user are all associated to :rankings with a polymorphic association named :rankable, can I somehow create methods on :rankable that would then be inherited by :post, :photo or :user? My guess is th...

scala - creating objects without making constructor parameter a member of the object

I have class Address(elem: scala.xml.Elem){ val attr1 = (elem \ "attr1") text ... } I do not want elem to be a member of Address to keep the the footprint to minimum as I create few millions of such objects in memory. What is the scala way to achieve this? Thanks. ...

So now struct can have virtual function and support inheritance ? What difference with classes then ? What the true purpose of information hiding ?

Possible Duplicate: What are the differences between struct and class in C++ http://www.cplusplus.com/reference/std/typeinfo/type_info/ I guess my "teacher" didn't tell me a lot about the differences between struct and classes in C++. I read in some other question that concerning inheritance, struct are public by default... ...

How to get child property inside parent class?

Hi all, Could you answer me how to do next, please? How to do this with Lambda? Is it possible to delegate some object instance and use its properties and methods in case if this method doesn't know type of delegated object? class class_a { public string getChildData<T> (T dynamicInstance) { return dynamicInstance.prop; ...

Is there a way to make a clone in CSS?

For example I have this css class: .class{ background:#FFF; border:1px solid #ccc } And I have this HTML structure: <ul class="list"> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> And I would like to use the .class on the list. li elements without adding the class="class" to the <li>'s or rewriting the whole...

C++ Does not name to a type

This might be an easy question, but I cannot figure out why the compiler it's giving me this error. I have two classes. Agent and Environment. WHen I try to add an object of type Agent in my Environment class I get Agent does not name to a type error. I am including Agent.h in my Environment.h class #ifndef AGENT_H_INCLUDED #define AGE...

Nested Classes C++ static inner methods (Xml parsing and trying to populate vector with values)

So this is what I am trying to accomplish. I am trying to use a sax parser to parse some XML. it looks like I need to call all their methods as statics. So if I want to pass a value back from say startElement it is static void startElement. Which brings me to my example code. I have been pulling my hair on how to update a value in a Nes...

[Delphi7] onResize event with class object

Here's is my code: type TNav = class(TPanel) private procedure CMMouseEnter(var AMsg: TMessage); message CM_MOUSEENTER; procedure CMMouseLeave(var AMsg: TMessage); message CM_MOUSELEAVE; public end; type TForm1 = class(TForm) ... procedure FormCreate(Sender: TObject); private public end; procedure TForm1.FormCreate(Sender: TOb...