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

PHP Interview Questions

1.   Which is the latest version of PHP.  The latest stable version of PHP is  5.6.7  released at March 20, 2015 . 2.   Define PHP. PHP is an open source  server side scripting  language used to develop dynamic websites . PHP  stands for Hypertext Preprocessor , also stood for   Personal Home Page .  Now the implementations of PHP is produced by The PHP group .It was created by  Rasmus lerdorf in 1995  . It is a free software released under the PHP license . 3.   Who is the father of PHP. Rasmus Lerdorf known as the father of PHP . Php was created by Rasmus Lerdorf In 1995 . 4.   What is the current version of Apache. The latest  stable version of  Apache  is   2.4.12 , released  on 29th  January  2015. 5.   What is difference between unset and unlink.. Unset is used to delete(destroy) a variable whereas unlink used to delete...

.NET Interview Question and Answer

Chapter 1: MS-SQL Server Q1. What is Relation in RDBMS? Ans A table in a database is called as relation. Q2. What is Tuple? Ans A Row of a table in database is called as tuple. Q3. What is RDBMS? Ans 1: DBMS is a layer of abstraction between application and database.2:Application interact with the Database via DBMS using Structure Query Language(SQL). 3 : If the database is logically in the form of tables i.e., relation then we call this DBMS as RDBMS. Q4. What is Primary Key? 1: Primary Key is a column of a table which is used to identity a row uniquely.  2: Primary Key cannot have NULL values. 3: Primary Key cannot have duplicate values. Q5. What is Unique Key? ● Unique Key is a column in a table which does not allow duplicate values like primary key. 2: It allows one and only one NULL values. 3: A table can have one and only one primary key. 4: A table can have one or more unique keys. Q6. What is Foreign key? Ans Foreign key is a column of one table wh...

PHPMailer

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php require_once "class.phpmailer.php"; $mail = new PHPMailer; $mail->From = "muhammad.kaleem@people.com.pk"; $mail->FromName = "Kaleem People"; $mail->addAddress("muhammad.kaleem@people.com.pk", "Kaleem Add Address Name"); //Provide file path and name of the attachments //$mail->addAttachment("file.txt", "File.txt"); $mail->addAttachment("file.txt");   $mail->addAttachment("../images/profile-pic.jpg"); $mail->addAttachment("../report/20090520-074141_sr-march09 ...