FACULTY OF ENGINEERING AND TECHNOLOGY
Department of Computer Engineering
01CE0523 - .NET Technologies
Experiment 2
AIM: Program on Inheritance and Interface
Source: [Link]
Code:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
namespace Practical2
{
class Character
{
public string name;
public int characterCode;
public string characterType;
}
class Protagonist : Character
{
public Protagonist()
{
[Link] = "Favorite character in the Series";
}
public void ShowProtagonistAction()
{
[Link]("The Protagonist will be : " + [Link]);
}
}
class MainCharacter : Protagonist
{
public MainCharacter(string cname, int cCode)
{
[Link] = cname;
[Link] = cCode;
}
public void ShowMainCharacterAction()
{
ShowProtagonistAction();
[Link]("The name of the Character is: " + [Link]);
[Link]("The Code of the Character is: " +
[Link]);
}
}
/*class SecondaryCharacter : Protagonist
{
GUY BRUNO NDIKUMANA(92200103297) BATCH: C |4
FACULTY OF ENGINEERING AND TECHNOLOGY
Department of Computer Engineering
01CE0523 - .NET Technologies
class Antagonist : Character
{
class MainAntagonist: Antagonist
{
}
class SecondaryAntagonist : Antagonist
{
}
*/
class Program
{
static void Main(string[] args)
{
[Link]("92200103297, Bruno");
Protagonist shanks = new Protagonist();
[Link]();
MainCharacter luffy = new MainCharacter("Monkey D. Luffy", 35);
[Link]();
[Link]();
}
}
}
Output:
GUY BRUNO NDIKUMANA(92200103297) BATCH: C |5