Created
March 5, 2023 06:17
-
-
Save rana01645/8ec884a381b2423a050a562a9e42f533 to your computer and use it in GitHub Desktop.
ChatGPT Use Cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Transform code from one language to another | |
Prompt: | |
Write this code in Java | |
<?php | |
class Animal | |
{ | |
public $name; | |
public $breed; | |
public function __construct($name, $breed) | |
{ | |
$this->name = $name; | |
$this->breed = $breed; | |
} | |
public function greet() | |
{ | |
return "Hello ! My name is " . $this->name . " and I am a " . $this->breed . "<br>"; | |
} | |
} // class Animal | |
class Dog extends Animal | |
{ | |
public function play() | |
{ | |
return $this->name . " loves to play.<br>"; | |
} | |
} //class Dog | |
$dog = new Dog("Max", "Labra"); | |
echo $dog->greet(); | |
echo $dog->play(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment