{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "20dfcaec",
   "metadata": {},
   "source": [
    "# Review Questions\n",
    "\n",
    "- Follow the lab instructions as seen in, e.g., Chapter 10 to prepare this lab.\n",
    "- Name this lab Ch11OOPLab.\n",
    "\n",
    "1. What is the relationship between \"student1\" and class Student in the following code?\n",
    "\n",
    "> ```{code-block} csharp\n",
    "> :linenos: true\n",
    ">\n",
    "> using System;\n",
    "> public class Student {\n",
    ">\n",
    ">   private string studentName;\n",
    ">   private int studentAge;\n",
    ">\n",
    ">   public string Name\n",
    ">   {\n",
    ">       get { return studentName; }\n",
    ">       set { studentName = value; }\n",
    ">   }\n",
    ">   public int Age\n",
    ">   {\n",
    ">       get { return studentAge; }\n",
    ">       set { studentAge = value; }\n",
    ">   }\n",
    "> }\n",
    ">\n",
    "> public class GFG {\n",
    ">   static public void Main()\n",
    ">   {\n",
    ">       Student student1 = new Student();\n",
    ">       // Student student2 = new Student();\n",
    ">       // Student student3 = new Student();\n",
    ">       student1.name = \"Doris\";\n",
    ">       Console.WriteLine(\"student1.name: \" + student1.name);\n",
    ">   }\n",
    "> }\n",
    "> ```\n",
    "\n",
    "2. In the preceding code, if you uncomment student2 and student3, will the code\n",
    "   execute without error?\n",
    "3. In the preceding code, if the content of the Main method is changed to the following,\n",
    "   what would the output be?\n",
    "\n",
    "> ```csharp\n",
    "> Student obj = new Student();\n",
    "> obj.Name = \"TY Chen\";\n",
    "> obj.Age = 35;\n",
    "> Console.WriteLine(\" Name : \" + obj.Name);\n",
    "> Console.WriteLine(\" Age : \" + obj.Age);\n",
    "> ```\n",
    "\n",
    "4. Perform the following tasks:\n",
    "\n",
    "   1. Inherit from the following abstract class Shape to create two derived classes: Triangle and Rectangle.\n",
    "   2. Implement the method so that Triangle and Rectangle are able to calculate the areas respectively.\n",
    "   3. Prepare the three classes in a file called Shape.cs and run the code from the method in Program.cs.\n",
    "   4. Note that in the derived classes you may need to design fields in addition to implementing the method.\n",
    "\n",
    "> ```csharp\n",
    "> public abstract class Shape\n",
    "> {\n",
    ">     public abstract double GetArea();\n",
    "> }\n",
    "> ```"
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
