Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Social Networking And Marketing Interviews:Digital Marketing ManagerNews And Article WritersOnline Media OperatorPHP Community Marketing ExpertPublic Relations AssistantPublic Relations ManagerSMMSocial MediaSocial Media ExecutiveSocial Media Specialist
Copyright © 2018. All Rights Reserved
PHP Community Marketing Expert Interview Question:
How to implement a class named Dragonball. This class must have an attribute named ballCount (which starts from 0) and a method iFoundaBall. When iFoundaBall is called, ballCount is increased by one. If the value of ballCount is equal to seven, then the message You can ask your wish is printed, and ballCount is reset to 0. How would you implement this class?
Submitted by: Muhammad<?php
class dragonBall{
private $ballCount;
public function __construct(){
$this->ballCount=0;
}
public function iFoundaBall(){
$this->ballCount++;
if($this->ballCount===7){
echo "You can ask for your wish.";
$this->ballCount=0;
}
}
}
?>
This question will evaluate a candidate’s knowledge about OOP.
Submitted by: Muhammad
class dragonBall{
private $ballCount;
public function __construct(){
$this->ballCount=0;
}
public function iFoundaBall(){
$this->ballCount++;
if($this->ballCount===7){
echo "You can ask for your wish.";
$this->ballCount=0;
}
}
}
?>
This question will evaluate a candidate’s knowledge about OOP.
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.