class.class = classI understand that when you define a new class it´s an instance of
Class...
class Test
end
So you can treat "Test" as an object and asks its class :
Test.class
Class
Is this Class itself an object ?
Because when i do Class.class, ruby gives me 'Class'
So is Class an instance of itself? I don´t understand the logic behind
this :(
Thanks
--
Posted via http://www.ruby-forum.com/.
Hi,
Am Freitag, 17. Jul 2009, 20:54:26 +0900 schrieb Rubynewbie Rubynewbie:
> I understand that when you define a new class it=C2=B4s an instance of
> Class...
>=20
> c...
Class classHi,
Could I construct an object using class class?
For example, I want to construct Integer("8") using class
Class class=Integer.class;
How to use class to obtain an Integer I which is equal to new
Integer("8")?
Thanks!
On 29-5-2005 7:33, eeh wrote:
> Hi,
>
> Could I construct an object using class class?
>
> For example, I want to construct Integer("8") using class
>
> Class class=Integer.class;
>
> How to use class to obtain an Integer I which is equal to new
> Integer("8")?
>
> Thanks!
>
<http:/...
Class in class?Hello
In Pascal, I use constructions like that
var SomeVar =3D object
SomeVar2 =3D object
end;
end;
etc., so I could put my object into another
object. Is this possible in PHP?
Some like:
class NameOfClass
{
class AnotherClass
{
}
}
?
The construction above is invalid, I tried.
But maybe I can do that another way?
TIA.
PS: sorry for my english.
--=20
greets
Tadeusz
Nie mozesz czegos takiego zrobic. Tylko... zamiast pytac pr=F3buj!
:)
You can't do that ;)
> Tylko... zamiast pytac pr=F3buj!
sorry, nie doczyt...
classes in a classI have a class that performs transformations on data streams. As written,
the class constructor takes several parameters and a data-source to produce
it's stream.
I have the need to combine the output of two instances of this class to
generate a third data stream. (think eg of applying a filters to audio)
When I do this, the parameters that I supply the second class are dependent
upon the state of the system after the first transform has occured.
I have been accomplishing this by using a function outside the class that
instantiates the two classes as the information needed to insta...
class in classclass A
{
public:
void myfunc1(){return;};
int a12;
char p[128];
class C
{
public:
int i123;
float f123;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
A a;
A::C t;
//how can i access A using t here
return 0;
}
now how can i access the class A from the class C object?
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Note up front: the term for a class declared inside another class is 'nested
class'.
subkriskat wrote:
> class A
> {
> class C
> { [...] ...
Nested Class, Member Class, Inner Class, Local Class, Anonymous ClassHi,
What is actually the difference between a Nested Class, a Member Class,
an Inner Class, a Local Class, and an Anonymous Class?
This is what i know so far:
A nested class is probably a generic term for all Class declaration
that are not top-level declarations. i.e. so member classes, inner
classes, local classes and anonymous classes are all nested classes. Is
that correct?
An anonymous class doesn't have a formal class name. e.g. we declare an
anonymous class that implements an ActionListener as follows:
ActionListener al = new ActionListener()
{
public void actionPerformed(Actio...
Class A contains class B, class B points to class A
Okay.
So I have a class A, which contains a vector of B.
Any B item is owned by a single, unique A. Indeed, when we create A, A
creates its B items.
B would like to know which A it is contained in, without having to be
perpetually told it by being passed A when B methods are called.
How can B store its A (or some handle to A) if A stores B?
Say that B has a pointer to its A.
However, if I create a copy of an A object and delete the original, all
the B->A pointers are invalidated. Doh!
Another solution would be to have a boost::shared_ptr to A in each B.
But that doesn't work, becau...
A parameterized class (i.e. template class / class template) is not a class?It appears that the following is not considered a class:
template<typename T>
class C { };
?
So officially is this considered: a class, a template, a class template, or
a template class? I always thought of it as a parameterized class. What
would the rationale be for not considering it as just a 'class'?
--
Christopher Diggins
Object Oriented Template Library (OOTL)
http://www.ootl.org
christopher diggins wrote:
> It appears that the following is not considered a class:
>
> template<typename T>
> class C { };
>
> ?
>
> So officially is ...
Class.class and class.getClass, whats the differencehi,
Is Class.class different from instanceOfClass.getClass() ?
I know it sounds blank. Let me explain the problem that I faced in
detail;
I have a class Class A with 2 protected methods and a private List
object.
Now in the test class of Class A, in a test case, I create a inner
class for Class A and override the two protected methods of Class A..
In addition I try to set up data in the List using relection.
i.e
testMtd(){
A a = new A(){
// Code for two overriden protected mtds here
};
Field f = A.class.getDeclaredField("NameOfTheListInClassA"); //This
works
Field f = a.getC...
How classes interact with other classesI have a very common problem when trying to design classes. What it
boils down to is this: if you have two classes which interact, which
class does what?
This will become clear if I use an example. Let's take part of an
email program. The program has a class to represent an email document
(class Email). The program also has a class to represent the
communication interface (class Interface), eg SMTP.
Now, we know that an email program needs to be able to send emails
through the interface. So here's my problem: Does the email know how
to send itself through the interface, or does the i...
class or class-instance ?hello,
I've a procedure (or in fact a class method) that should be callable with
either a class
(in which case the procedure should create an instance)
or with an instance of that class
as the parameter.
def somefunction ( self, parameter ) :
if parameter is a class, create an instance of that class
else do nothing
now I should be able to call the above procedure in either of the
following ways:
somefunction ( someclass )
or
somefunction ( someclass () )
thanks,
Stef Mientki
Stef Mientki schrieb:
> hello,
>
> I've a procedure (or...
Class diagramHi.
I'm designing a system where there's a class which should be
associated via FK to different classes.
For clarity, lets assume there are documents for customers and
documents for suppliers.
Each document would have exactly the same columns, so I would like to
have a single Document class to handle it.
Customer class might have a PK called UID.
Supplier class might have a PK called UID.
What would be the best way to achieve this?
I was thinking the Document class would have the following PK:
- ClassType (Customer/Supplier etc.)
- UID
ClassType would point to the appropriate clas...
When are classes loaded by other classes?If I have a class like this:
public class Tester {
ObjectType1 ot1;
ObjectType2 ot2;
ObjectType3 ot3;
public void main(String args) {
//Preliminary checking, resulting in bRun being
//true or false -- true means we continue, false, we quit:
if (bRun) {
Tester t = new Tester();
t.doStuff();
}
System.exit(0);
}
public Tester() {
//do stuff to create an instance of this class
...
Class in a Class problemMy intent is to create a class that has access to call a method in an
instantiation of another class
However my knowledge of Ruby classes (Ok classes in general) is
somewhat lacking
The example below is a LOT simplified But I need class B to call a
method within an instantiation of class A's.
one alternative is to seperate the classes and then just do "b=B.new
(a)" but I think that looks really messy and
- I have then to check a bunch of stuff about the parameter a
- I would have a world of more hurt trying to ensure that only one B
instantiation pointed to each a
Can anyon...