In C++, I code this way:
//foo.h class cBar { void foobar(); }
//foo.cpp void cBar::foobar() { //Code }
I tried to do this on PHP but the parser would complain. PHP’s documentation also doesn’t help. Can this be done in PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. You need to including all your function definitions inside the class block. If defining your functions in a separate structure makes you feel better you could use an interface.
I’d suggest just getting used to coding in a new way. It’s easy to code consistantly within a single language, but I think you are fighting a loosing battle if you want to do the same across languages.