php - Fatal error: Call to undefined method User::getSkipper() -


I'm trying to teach OOP myself in PHP, there is an error in my class, do anyone know that I Why is this error getting? Fatal error: Call the undefined method: User: getSkipper () in C: \ wamp \ www

The user category is:

  & lt ;? Php class user {protected $ _first_name} Protected $ _last_name; Secure $ _ Email; Public function __ conversion ($ first_name, $ last_name, $ email) {$ this- & gt; _first_name = $ first_name; $ This- & gt; _last_name = $ last_name; $ This- & gt; _email = $ email; } Public Function getFirstName () {Return $ $$-> _first_name; } Public function getLastName () {return $ this- & gt; _last_name; } Public Function getEmail () {Return $ this- & gt; _email; }}? & Gt;  

The Captain class is:

  & lt ;? Php square Captor protects the user {protected $ _skipper; Public Function __construct ($ first_name, $ last_name, $ email, $ captain) {$ this- & gt; _skipper = $ Captain; } Public event getSkipper () {Return $ $-> _cipper; }}? & Gt;  

Error thrown when executing the following code:

  $ user1 = New user ('Steven', 'Smith', 'Steve @ SledgeJacks DJ com ',' yes'); Echo & lt; P & gt; first name: '. $ User1- & gt; GetFirstName () '& Lt; / P & gt; '; Echo '& lt; P & gt; last name:'. $ User1- & gt; GetLastName () '& Lt; / P & gt; '; Echo '& lt; P & gt; E-mail:'. $ User1- & gt; GetEmail () '& Lt; / P & gt; '; Echo & lt; P & gt; Captain: '. $ User1- & gt; GetSkipper () '& Lt; / P & gt; ';  

You create an object in the class user and users There is no way getSkipper to be used, you should create an object of class Skipper .

  $ user1 = new skipper ('steven', 'smith', 'steve @ seljagsdsd.com', 'yes');  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -