Question related to Class and Object =>
1. write a class that name should be user :
2. Write class properties first and last name
3. Name of the method that return hello.
4. Create first instance, and call it user1. USe the new keyword
to create an object from the class
5. Set the values for the first and last name to $user1.
$firstName = 'John'
$lastName = 'Doe'
6. Get the user first and last name, and print it to the screen with echo. (Result: John Doe)
7. Use the hello() method with the first and last name variables in order to say hello to the user:
Expected result: hello, John Doe
8. Add another object, call it $user2, give it a first name of 'Jane' and last name of 'Doe', then say hello to the user.
Expected result:
hello, John Doe
hello, Jane Doe
No comments:
Post a Comment