Refer to class within function?



Am I supposed to get an error when I try to access a class within a function?

E.g.:

somepage.inc.php has a class:

--------------

class myclass
{
	myclass()
	{
		return "foo";
	}
}

-------------

Having included this class on default.php, I try to access it like this...

-------------

function getdata(){
	$thisreturn = new myclass();
	return $thisreturn;
}
-------------

If an error is expected, is there any way to access a class from within a function?

Thanks for any help.

--Brent
.



Relevant Pages

  • Re: How to return reference to class object from functions?
    ... > Suppose I have a function foo() and a class definition myClass, ... How can I return the reference from foo? ...
    (comp.lang.cpp)
  • Re: Implementing interface problem
    ... > returns an object of MyClass type. ... > public class MyClasss: ICloneable ... > of the class that implement this interface. ... public Foo Clone() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [incr Tcl] state of this project?
    ... yes; look at the following snipplet; it creates ... a class named "MyClass" and adds an instance method named ... "foo" to it. ... For real code, one should ...
    (comp.lang.tcl)
  • Re: new X vs new X()
    ... > class the call new MyClass is the same with the call new MyClass ... > (assuming the class has a default constructor). ... object of type Foo that has the same value that an otherwise uninitialized ... > pointer to an int that is not innitialized (it is not guaranteed to be ...
    (comp.lang.cpp)
  • Re: How to return reference to class object from functions?
    ... > Suppose I have a function foo() and a class definition myClass, ... Static myObject may fail in ...
    (comp.lang.cpp)