Skip to main content

Interface demo

//using System;

//Demo# 1

//class Demo
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Console.ReadLine();

//    }
//}

//interface abc
//{
//}

///*
// Output
//Hello Interfaces
// */


//Demo# 2

//class Demo
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//          Console.ReadLine();
//    }
//}

//interface abc
//{
//    int x;
//}

///*
// Output
//error CS0525: Interfaces cannot contain fields
// */


//Demo# 3

//class Demo
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Console.ReadLine();
//    }
//}

//interface abc
//{
//    void xyz()
//    {
//       Console.WriteLine("In xyz");
//    }
//}

///*
// Output
//    error CS0531: 'abc.xyz()': interface members cannot have a definition
// */

//Demo# 4

//class Demo
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Console.ReadLine();
//    }
//}

//interface abc
//{
//    void xyz();
//}

///*
// Output
//   Hello Interfaces
// */

//Demo# 5

//class Demo : abc
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Console.ReadLine();
//    }
//}

//interface abc
//{
//    void xyz();
//}

///*
// Output
//   error CS0535: 'Demo' does not implement interface member
// */

//Demo# 6

//class Demo : abc
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Console.ReadLine();

//    }

//    void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

///*
// Output
//     error CS0536: 'Demo' does not implement interface member
//    'abc.xyz()'.'Demo.xyz()' is either static, not public,
//    or has  the wrong return type.
// */

//Demo# 7

//class Demo : abc
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        xyz();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

///*
// Output
//     Hello Interfaces
//    In xyz
// */

//Demo# 8

//class Demo : abc
//{
//  public static void Main()
//  {
//    Console.WriteLine("Hello Interfaces");
//    Demo refDemo = new Demo();
//    refDemo.xyz();
//    Sample refSample = new Sample();
//    refSample.xyz();
//      Console.ReadLine();
//  }

//  public void xyz()
//  {
//     Console.WriteLine("In Demo :: xyz");
//  }
//}

//interface abc
//{
//  void xyz();
//}

//class Sample : abc
//{
//  public void xyz()
//  {
//     Console.WriteLine("In Sample :: xyz");
//  }
//}

///*
// Output
//     In Demo :: xyz
//     In Sample :: xyz
// */

//Demo# 9

//class Demo : abc
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        abc refabc = new Demo();
//        refabc.xyz();
//        abc refabc = new Sample();
//        refabc.xyz();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In Demo :: xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//class Sample : abc
//{
//    public void xyz()
//    {
//        Console.WriteLine("In Sample :: xyz");
//    }
//}


///*
// Output
//     In Demo :: xyz
//     In Sample :: xyz
// */

//Demo# 10

//class Demo : abc
//{
//    public static void Main()
//    {
//        abc[] refabc = { new Demo(), new Sample() };
//        for (int i = 0; i <= 1; i++)
//            refabc[i].xyz();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In Demo :: xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//class Sample : abc
//{
//    public void xyz()
//    {
//       Console.WriteLine("In Sample :: xyz");
//    }
//}

///*
// Output
//     In Demo :: xyz
//     In Sample :: xyz
// */

//Demo# 11

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        abc refabc = new Demo();
//        refabc.xyz();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    public void pqr()
//    {
//       Console.WriteLine("In xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void pqr();
//}

///*
// Output
//     Hello Interfaces
//    In xyz
// */

//Demo# 11

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        abc refabc = new Demo();
//        refabc.xyz();
//        refabc.pqr();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    public void pqr()
//    {
//        Console.WriteLine("In xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void pqr();
//}

///*
// Output
//     error CS0117: 'abc' does not contain a definition for 'pqr'
// */

//Demo# 12

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        abc refabc = refDemo;
//        refabc.xyz();
//        def refdef = refDemo;
//        refdef.pqr();
//        Console.ReadLine();

//    }

//    public void xyz()
//    {
//       Console.WriteLine("In xyz");
//    }

//    public void pqr()
//    {
//        Console.WriteLine("In pqr");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void pqr();
//}

///*
// Output
//     Hello Interfaces
//    In xyz
//    In pqr
// */

//Demo# 13

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        abc refabc = refDemo;
//        refabc.xyz();
//        def refdef = refDemo;
//        refdef.xyz();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }
//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void xyz();
//}

///*
// Output
//    Hello Interfaces
//    In xyz
//    In xyz
// */

//Demo# 14

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        abc refabc = refDemo;
//        refabc.xyz();
//        def refdef = refDemo;
//        refdef.xyz();
//        Console.ReadLine();
//    }

//    public void abc.xyz()
//    {
//        Console.WriteLine("In abc.xyz");
//    }

//    public void def.xyz()
//    {
//        Console.WriteLine("In def.xyz");
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void xyz();
//}

///*
// Output
//   error CS0106: The modifier 'public' is not valid for this item
// */

//Demo# 15

//class Demo : abc, def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        abc refabc = refDemo;
//        refabc.xyz();
//        def refdef = refDemo;
//        refdef.xyz();
//        Console.ReadLine();
//    }

//    void abc.xyz()
//    {
//        Console.WriteLine("In abc.xyz");
//    }

//    void def.xyz()
//    {
//        Console.WriteLine("In def.xyz");
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def
//{
//    void xyz();
//}

///*
// Output
//     Hello Interfaces
//    In abc.xyz
//    In def.xyz
// */

//Demo# 16

//class Demo : def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        def refdef = refDemo;
//        refdef.xyz();
//        refdef.pqr();
//        Console.ReadLine();
//    }

//    public void xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    public void pqr()
//    {
//        Console.WriteLine("In pqr");
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def : abc
//{
//    void pqr();
//}

///*
// Output
//    Hello Interfaces
//    In xyz
//    In pqr
// */

//Demo# 17


//class Demo : def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        def refdef = refDemo;
//        refdef.xyz();
//        refdef.pqr();
//        Console.ReadLine();
//    }

//    void def.xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    void def.pqr()
//    {
//        Console.WriteLine("In pqr");
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def : abc
//{
//    void pqr();
//}


///*
// Output
//   error CS0539: 'def.xyz' in explicit interface declaration is not a member of interface
//   error CS0535: 'Demo' does not implement interface member 'abc.xyz()'
// */

//Demo# 18

//class Demo : def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        def refdef = refDemo;
//        refdef.xyz();
//        refdef.pqr();
//        Console.ReadLine();
//    }

//    void abc.xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    void def.pqr()
//    {
//        Console.WriteLine("In pqr");
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def : abc
//{
//    void pqr();
//}


///*
// Output
//   Hello Interfaces
//   In xyz
//   In pqr
// */

//Demo# 19

//class Demo : def
//{
//    public static void Main()
//    {
//        Console.WriteLine("Hello Interfaces");
//        Demo refDemo = new Demo();
//        refDemo.xyz();
//        refDemo.pqr();
//        Console.ReadLine();
//    }

//    void abc.xyz()
//    {
//        Console.WriteLine("In xyz");
//    }

//    void def.pqr()
//    {
//        Console.WriteLine("In pqr");
     
//    }

//}

//interface abc
//{
//    void xyz();
//}

//interface def : abc
//{
//    void pqr();
//}

///*
// Output
//   error CS0117: 'Demo' does not contain a definition for 'xyz'
//   error CS0117: 'Demo' does not contain a definition for 'pqr'
// */


Comments

Popular posts from this blog

100 quick and fascinating facts about the human body

The only part of the body that has no blood supply is the cornea of the eye. It receives oxygen directly from the air. The human brain has a memory capacity which is the equivalent of more than four terabytes on a hard drive. A newborn child can breathe and swallow at the same time for up to seven months. Your skull is made up of 29 different bones. When you sneeze, all of your body functions stop — even your heart! Nerve impulses sent from the brain move at a speed of 274 km/h. A single human brain generates more electrical impulses in a day than all the telephones of the world combined. The average human body contains enough sulphur to kill all the fleas on the average dog, enough carbon to make 900 pencils, enough potassium to fire a toy cannon, enough fat to make seven bars of soap and enough wate...

Memoery Managment Problem

http://www.doc.ic.ac.uk/~eedwards/compsys/index.html 1. Given five memory partitions of 100Kb, 500Kb, 200Kb, 300Kb, 600Kb (in order), how would the first-fit, best-fit, and worst-fit algorithms place    processes of 212 Kb, 417 Kb, 112 Kb, and 426 Kb (in order)? Which algorithm makes the most efficient use of memory?  First-fit:  212K is put in 500K partition  417K is put in 600K partition  112K is put in 288K partition (new partition 288K = 500K - 212K)  426K must wait  Best-fit:  212K is put in 300K partition  417K is put in 500K partition  112K is put in 200K partition  426K is put in 600K partition  Worst-fit:  212K is put in 600K partition  417K is put in 500K partition  112K is put in 388K partition  426K must wait  In this example, best-fit turns out to be the best. 2. Assuming a 1 KB page size, what are the page numbers and offsets for the following address refer...

Software Engineering Question

design patterns database normalisation database design database keys(primary,secondary, unique, composite) indexing joins, group by Link lists .NET architecture polymorphism diamond problem and its solution association, composition, aggregation copy constructor, shallow copy, deep copy coupling, cohesion Difference b/W interface and abstract class general oop diff b/W string="abc" and String string="abc" diff b/w int and int32 operating System (threading,diff b/w soft interrupt and hard interrupt, each programe in 32bit consumes how much memory) Codes both iterative and recursive with running times factorial fibonachi BFS,DFS Sequence Diagram Virtual memory Deadlock Binary search tree logical model, physical model how to delete 2nd or 3rd last element in linked list how to find midle element in linked list how to find whether a linked list is circuler or not scheduling Algorithm(FCFS, SJF, Prio, RRA)   How to find sequence lengt...