Jump to content

Search the Community

Showing results for tags 'constructor'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Is there any real difference between those two? I'm 80% inclined to say no, but I'm not 100% sure.
  2. Hi. I'm just a starter on php, i would like to ask on how to display the string that I assigned in my constructor. Car.php class Car { private $color; private $horsepower; private $seats; public function getColor() { return $this->color; } public function setColor($color) { $this->color = $color; } public function getHorsepower() { return $this->horsepower; } public function setHorsepower($horsepower) { $this->horsepower = $horsepower; } public function getSeats() { return $this->seats; } public function setSeats($seats) { $this->seats = $seats; } } RaceCar.php class RaceCar extends Car { function __construct() { $this->setColor("red"); $this->setHorsepower("23"); $this->setSeats("four"); } } and the index.php where I call them, index.php <body> <?php include_once('Car.php'); include_once('RaceCar.php'); $raceCar = new RaceCar(); echo "color: " + $raceCar->getColor(); echo "horsepower: " + $raceCar->getHorsepower(); echo "seats: " + $raceCar->getSeats(); ?> </body>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.