Inheritance and function arguments taking objects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
valaris
Forum Newbie
Posts: 1
Joined: Thu Jun 19, 2008 11:57 am

Inheritance and function arguments taking objects

Post by valaris »

I was wondering if this would work or be at all practical. I have a class that sets up my sql connection, and performs queries/returns results called System, and another class that extends it Login, that will log a user in. A third class that will get info about a user takes an object as an argument, specifically a Login object. Now in my third class can I call on my object variables of type system that are declared in my Login object that i passed to my third object?

Hopefully im not too confusing.

Thanks.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Inheritance and function arguments taking objects

Post by Christopher »

You can if they are public, or have getters/setters. Have you tried it? Things like this are very easy to test...
(#10850)
Post Reply