"Hugh Oxford" <arestes@fas.co mwrote in message
news:48d2bf98$0 $2507$da0feed9@ news.zen.co.uk. ..
How do I get an object's name?
>
>
EG.
>
$obj_FOO = new Bar;
>
echo $obj_FOO->getName();
>
'obj_FOO'
Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have answers...in
TFM. Case in point:
Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have answers...in
TFM. Case in point:
Thanks for your help.
With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
"Hugh Oxford" <arestes@fas.co mwrote in message
news:48d2c4f6$0 $2509$da0feed9@ news.zen.co.uk. ..
Oscar Arreyano wrote:
>
>Actually what you want is the *variable* name. The object's name is
>Bar...and unless Bar has a method called 'getName', you should see some
>errors. As always, 90% of the questions asked here already have
>answers...in TFM. Case in point:
>
Thanks for your help.
>
With all due respect, the name of the class is Bar. I've never thought of
an object as a variable, because you cannot change the value of it. So I
hope you can understand my confusion.
You owe me no respect, but thanks. The name of the class is Bar, yes. Class
is more of an adjective...a 'type' of object. A variable stores a reference
to an instance of an object, not the class which defines it. Either way, I
understand the confusion of not being able to find what you were looking
for. Knowing what to ask is the key. I'm glad we've got it all sorted out.
:)
Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't rely
on that setting but will return all defined variables...The y should be used
instead, IMO.
"Hugh Oxford" <arestes@fas.co mwrote in message
news:48d2c4f6$0 $2509$da0feed9@ news.zen.co.uk. ..
>Oscar Arreyano wrote:
>>
>>Actually what you want is the *variable* name. The object's name is
>>Bar...and unless Bar has a method called 'getName', you should see some
>>errors. As always, 90% of the questions asked here already have
>>answers...i n TFM. Case in point:
>Thanks for your help.
>>
>With all due respect, the name of the class is Bar. I've never thought of
>an object as a variable, because you cannot change the value of it. So I
>hope you can understand my confusion.
>
You owe me no respect, but thanks. The name of the class is Bar, yes. Class
is more of an adjective...a 'type' of object. A variable stores a reference
to an instance of an object, not the class which defines it. Either way, I
understand the confusion of not being able to find what you were looking
for. Knowing what to ask is the key. I'm glad we've got it all sorted out.
:)
>
Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't rely
on that setting but will return all defined variables...The y should be used
instead, IMO.
>
Cheers.
>
>
>
No, an object is an instantiation of a class. But you never could
figure that one out, could you?
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
>Actually what you want is the *variable* name. The object's name is
>Bar...and unless Bar has a method called 'getName', you should see
>some errors. As always, 90% of the questions asked here already have
>answers...in TFM. Case in point:
>
Thanks for your help.
>
With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
>
Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gav471$5ql $2@registered.m otzarella.org.. .
Oscar Arreyano wrote:
>"Hugh Oxford" <arestes@fas.co mwrote in message
>news:48d2c4f6$ 0$2509$da0feed9 @news.zen.co.uk ...
>>Oscar Arreyano wrote:
>>>
>>>Actually what you want is the *variable* name. The object's name is
>>>Bar...and unless Bar has a method called 'getName', you should see some
>>>errors. As always, 90% of the questions asked here already have
>>>answers... in TFM. Case in point:
>>Thanks for your help.
>>>
>>With all due respect, the name of the class is Bar. I've never thought
>>of an object as a variable, because you cannot change the value of it.
>>So I hope you can understand my confusion.
>>
>You owe me no respect, but thanks. The name of the class is Bar, yes.
>Class is more of an adjective...a 'type' of object. A variable stores a
>reference to an instance of an object, not the class which defines it.
>Either way, I understand the confusion of not being able to find what you
>were looking for. Knowing what to ask is the key. I'm glad we've got it
>all sorted out. :)
>>
>Btw, the example given, strictly, will only work if globals are turned
>on...which is bad. However, there are several php functions that don't
>rely on that setting but will return all defined variables...The y should
>be used instead, IMO.
>>
>Cheers.
>
No, an object is an instantiation of a class. But you never could figure
that one out, could you?
I wish you could r*e*a*d*, Jerry. Here's what I said:
<quote>
variable stores a reference to an instance of an object
</quote>
A class is the mechanics that define how the instantiated object will
behave.
How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to behave
like a child. You are an instance of an imbecile and you have *no* class.
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gav4ba$5ql $3@registered.m otzarella.org.. .
Hugh Oxford wrote:
>Oscar Arreyano wrote:
>>
>>Actually what you want is the *variable* name. The object's name is
>>Bar...and unless Bar has a method called 'getName', you should see some
>>errors. As always, 90% of the questions asked here already have
>>answers...i n TFM. Case in point:
>>
>Thanks for your help.
>>
>With all due respect, the name of the class is Bar. I've never thought of
>an object as a variable, because you cannot change the value of it. So I
>hope you can understand my confusion.
>>
>
Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.
An object is a NOT a variable. How long have you been programming?!!!
$i
What methods can i enact on $i? none.
$i = 'Oh my!';
Did I pick up any interfaces yet? Maybe in javascript, perl, or .Net...but
not in php.
A variable is a reference to something in memory, be it a literal reference,
pointer, or copy of something. A variable is NOT an object.
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gav471$5ql $2@registered.m otzarella.org.. .
>Oscar Arreyano wrote:
>>"Hugh Oxford" <arestes@fas.co mwrote in message
>>news:48d2c4f6 $0$2509$da0feed 9@news.zen.co.u k...
>>>Oscar Arreyano wrote:
>>>>
>>>>Actually what you want is the *variable* name. The object's name is
>>>>Bar...and unless Bar has a method called 'getName', you should see some
>>>>errors. As always, 90% of the questions asked here already have
>>>>answers...i n TFM. Case in point:
>>>Thanks for your help.
>>>>
>>>With all due respect, the name of the class is Bar. I've never thought
>>>of an object as a variable, because you cannot change the value of it.
>>>So I hope you can understand my confusion.
>>You owe me no respect, but thanks. The name of the class is Bar, yes.
>>Class is more of an adjective...a 'type' of object. A variable stores a
>>reference to an instance of an object, not the class which defines it.
>>Either way, I understand the confusion of not being able to find what you
>>were looking for. Knowing what to ask is the key. I'm glad we've got it
>>all sorted out. :)
>>>
>>Btw, the example given, strictly, will only work if globals are turned
>>on...which is bad. However, there are several php functions that don't
>>rely on that setting but will return all defined variables...The y should
>>be used instead, IMO.
>>>
>>Cheers.
>No, an object is an instantiation of a class. But you never could figure
>that one out, could you?
>
I wish you could r*e*a*d*, Jerry. Here's what I said:
>
<quote>
variable stores a reference to an instance of an object
</quote>
>
A class is the mechanics that define how the instantiated object will
behave.
>
How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to behave
like a child. You are an instance of an imbecile and you have *no* class.
>
>
>
Yes, I read what you said - and you got it wrong (again).
There is no such thing as an "instance of an object". An object exists
or it doesn't exist. Objects are instances of a class.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gav4ba$5ql $3@registered.m otzarella.org.. .
>Hugh Oxford wrote:
>>Oscar Arreyano wrote:
>>>
>>>Actually what you want is the *variable* name. The object's name is
>>>Bar...and unless Bar has a method called 'getName', you should see some
>>>errors. As always, 90% of the questions asked here already have
>>>answers... in TFM. Case in point:
>>Thanks for your help.
>>>
>>With all due respect, the name of the class is Bar. I've never thought of
>>an object as a variable, because you cannot change the value of it. So I
>>hope you can understand my confusion.
>>>
>Yes, an object is a variable because you can change it's value. In this
>case the value would be the data members of the class.
>
An object is a NOT a variable. How long have you been programming?!!!
>
Over 40 years. How long have you been programming? 40 days?
$i
>
What methods can i enact on $i? none.
>
It depends on the type of the variable.
$i = 'Oh my!';
>
Did I pick up any interfaces yet? Maybe in javascript, perl, or .Net...but
not in php.
>
In a broad sense, yes. You can perform concatenation on it, for
instance. If you had $i=3; you could perform other operations on it
such as addition, subtraction...
$i = new myObject().
Now $i is an object.
A variable is a reference to something in memory, be it a literal reference,
pointer, or copy of something. A variable is NOT an object.
>
Dunce!
>
If you want to go to that level, then there is no such thing as a
variable, an object or anything else. Everything is just things in memory.
But intelligent programmers don't think that way.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gb0ajn$qae $1@registered.m otzarella.org.. .
Oscar Arreyano wrote:
>"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
>news:gav471$5q l$2@registered. motzarella.org. ..
>>Oscar Arreyano wrote:
>>>"Hugh Oxford" <arestes@fas.co mwrote in message
>>>news:48d2c4f 6$0$2509$da0fee d9@news.zen.co. uk...
>>>>Oscar Arreyano wrote:
>>>>>
>>>>>Actually what you want is the *variable* name. The object's name is
>>>>>Bar...an d unless Bar has a method called 'getName', you should see
>>>>>some errors. As always, 90% of the questions asked here already have
>>>>>answers... in TFM. Case in point:
>>>>Thanks for your help.
>>>>>
>>>>With all due respect, the name of the class is Bar. I've never thought
>>>>of an object as a variable, because you cannot change the value of it.
>>>>So I hope you can understand my confusion.
>>>You owe me no respect, but thanks. The name of the class is Bar, yes.
>>>Class is more of an adjective...a 'type' of object. A variable stores a
>>>reference to an instance of an object, not the class which defines it.
>>>Either way, I understand the confusion of not being able to find what
>>>you were looking for. Knowing what to ask is the key. I'm glad we've
>>>got it all sorted out. :)
>>>>
>>>Btw, the example given, strictly, will only work if globals are turned
>>>on...which is bad. However, there are several php functions that don't
>>>rely on that setting but will return all defined variables...The y
>>>should be used instead, IMO.
>>>>
>>>Cheers.
>>No, an object is an instantiation of a class. But you never could
>>figure that one out, could you?
>>
>I wish you could r*e*a*d*, Jerry. Here's what I said:
>>
><quote>
>variable stores a reference to an instance of an object
></quote>
>>
>A class is the mechanics that define how the instantiated object will
>behave.
>>
>How can one be your age and not be able to read? Maybe you need a new
>prescription for your glasses? Either way, it's too bad you have to
>behave like a child. You are an instance of an imbecile and you have *no*
>class.
>
Yes, I read what you said - and you got it wrong (again).
>
There is no such thing as an "instance of an object". An object exists or
it doesn't exist. Objects are instances of a class.
A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...t herefore, it
is *instanciated*. Blue-prints are nothing more than computer directives.
While losely considered, an object *is* sometimes called an instance of a
class. However, NONE of that is what I contend!!! Which is why I said YOU
CAN'T READ!!!
I merely said, yet one more time for the eternally clueless, a *variable* is
a reference to an instance of an object. Provide me ONE piece of literature
that agrees with YOU that objects HAVE NO INSTANCES. Just one, Jerry!
Whether or not you consider an object to be an instance of a class or just
the computer's product from a blue-print is COMPLETELY IMMATERIAL.
Learn to read...once you do that, learn to program!
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gb0au2$tbg $1@registered.m otzarella.org.. .
Oscar Arreyano wrote:
>"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
>news:gav4ba$5q l$3@registered. motzarella.org. ..
>>Hugh Oxford wrote:
>>>Oscar Arreyano wrote:
>>>>
>>>>Actually what you want is the *variable* name. The object's name is
>>>>Bar...and unless Bar has a method called 'getName', you should see
>>>>some errors. As always, 90% of the questions asked here already have
>>>>answers...i n TFM. Case in point:
>>>Thanks for your help.
>>>>
>>>With all due respect, the name of the class is Bar. I've never thought
>>>of an object as a variable, because you cannot change the value of it.
>>>So I hope you can understand my confusion.
>>>>
>>Yes, an object is a variable because you can change it's value. In this
>>case the value would be the data members of the class.
>>
>An object is a NOT a variable. How long have you been programming?!!!
>>
>
Over 40 years. How long have you been programming? 40 days?
You obviously are a very slow learner in that case!
>$i
>>
>What methods can i enact on $i? none.
>>
>
It depends on the type of the variable.
And the language you're using! Which IS the point!!! A variable IS NOT an
OBJECT. It may represent one, but it is NOT one.
>$i = 'Oh my!';
>>
>Did I pick up any interfaces yet? Maybe in javascript, perl, or
>.Net...but not in php.
>>
>
In a broad sense, yes. You can perform concatenation on it, for instance.
If you had $i=3; you could perform other operations on it such as
addition, subtraction...
NOT in ANY SENCE. I can concatentate, do math, or whatever on it because of
its TYPE!!! TYPE != OBJECT!!!
You should have spent some of you 40+ years 'programming' in actually
reading *about* programming. :)
$i = new myObject().
>
Now $i is an object.
>
>A variable is a reference to something in memory, be it a literal
>reference, pointer, or copy of something. A variable is NOT an object.
>>
>Dunce!
>
If you want to go to that level, then there is no such thing as a
variable, an object or anything else. Everything is just things in
memory.
Not true! I cannot make an object point to another object unless it is of
the correct TYPE or has an interface to do so. You are simply building
strawmen now! A variable represents something in memory. Objects and data
types define what is IN memory and what outcomes will be produced when
consumed. It is harder to manipulate any of that without the use of
variables.
A variable is a PRONOUN for something else...*always* .
But intelligent programmers don't think that way.
'intelligent' programmers think very carefully about memory...others just
don't mind leaks. I now know the category in which you fit. That's to a
certainty. Prior to your first garblings, I thought you were just new and
naive when it came to programming.
"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
news:gb0ajn$qae $1@registered.m otzarella.org.. .
>Oscar Arreyano wrote:
>>"Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
>>news:gav471$5 ql$2@registered .motzarella.org ...
>>>Oscar Arreyano wrote:
>>>>"Hugh Oxford" <arestes@fas.co mwrote in message
>>>>news:48d2c4 f6$0$2509$da0fe ed9@news.zen.co .uk...
>>>>>Oscar Arreyano wrote:
>>>>>>
>>>>>>Actuall y what you want is the *variable* name. The object's name is
>>>>>>Bar...a nd unless Bar has a method called 'getName', you should see
>>>>>>some errors. As always, 90% of the questions asked here already have
>>>>>>answers.. .in TFM. Case in point:
>>>>>Thanks for your help.
>>>>>>
>>>>>With all due respect, the name of the class is Bar. I've never thought
>>>>>of an object as a variable, because you cannot change the value of it.
>>>>>So I hope you can understand my confusion.
>>>>You owe me no respect, but thanks. The name of the class is Bar, yes.
>>>>Class is more of an adjective...a 'type' of object. A variable stores a
>>>>reference to an instance of an object, not the class which defines it.
>>>>Either way, I understand the confusion of not being able to find what
>>>>you were looking for. Knowing what to ask is the key. I'm glad we've
>>>>got it all sorted out. :)
>>>>>
>>>>Btw, the example given, strictly, will only work if globals are turned
>>>>on...whic h is bad. However, there are several php functions that don't
>>>>rely on that setting but will return all defined variables...The y
>>>>should be used instead, IMO.
>>>>>
>>>>Cheers.
>>>No, an object is an instantiation of a class. But you never could
>>>figure that one out, could you?
>>I wish you could r*e*a*d*, Jerry. Here's what I said:
>>>
>><quote>
>>variable stores a reference to an instance of an object
>></quote>
>>>
>>A class is the mechanics that define how the instantiated object will
>>behave.
>>>
>>How can one be your age and not be able to read? Maybe you need a new
>>prescriptio n for your glasses? Either way, it's too bad you have to
>>behave like a child. You are an instance of an imbecile and you have *no*
>>class.
>Yes, I read what you said - and you got it wrong (again).
>>
>There is no such thing as an "instance of an object". An object exists or
>it doesn't exist. Objects are instances of a class.
>
A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...t herefore, it
is *instanciated*. Blue-prints are nothing more than computer directives.
While losely considered, an object *is* sometimes called an instance of a
class. However, NONE of that is what I contend!!! Which is why I said YOU
CAN'T READ!!!
>
That's right. And an object is an instance of a class. There is no
such thing as an instance of an object.
I merely said, yet one more time for the eternally clueless, a *variable* is
a reference to an instance of an object. Provide me ONE piece of literature
that agrees with YOU that objects HAVE NO INSTANCES. Just one, Jerry!
Whether or not you consider an object to be an instance of a class or just
the computer's product from a blue-print is COMPLETELY IMMATERIAL.
>
Learn to read...once you do that, learn to program!
>
>
>
Just about any of the OO literature by the recognized authorities out there.
But it's about your level of comprehension, Steve. You're just a
stoopid idiot.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
Comment