Showing posts with label C# Console App. Programming. Show all posts
Showing posts with label C# Console App. Programming. Show all posts

Monday, 5 November 2012

Another program to illustrate the use of explicit interface implementation


using System;
class ExplicitInterface
{
 interface readFile
 {
  void Read();
  void Write();
 }

Program to show the inheritance using abstract class


using System;
class Program
{
 static void Main()
 {
  ABS[] aArray = new ABS[3];

Program to illustrate the use of explicit interface implementation


using System;
interface I1
{
 void Display();
}
interface I2

Program for inheriting a class that implements an interface


using System;
interface Display
{
 void Print();
}
class B : Display
{
 public void Print()

Program for multiple implimentation of an interface


using System;
interface Area
{
 double Compute(double x);
}
class Square : Area
{
 public double Compute(double x){ return x*x; }

Program for Implementation of multiple interface


using System;
interface Addition { int Add(); }
interface Multiplication { int Mul(); }
class Computation : Addition , Multiplication
{
 int x,y;
 public Computation(int x,int y)
 {

Sunday, 4 November 2012

Program to implementing a property in C sharp.


using System;
class Number
{
 int number;
 public int Anumber

Program to show the upcasting of an object of Derived class to an object of its base class


using System;
class Maruti
{
 public virtual void Display()
 {

Program of hierarchical inheritance and function overriding


using System;
class BaseClass
{
 public int num1,num2,num3;
 public virtual int function1()
 {

Program to show the use of sealed keyword on methods in inheritance and overriding


using System;
class GrandParent
{
 private string clname;
 public GrandParent(){}

Program to show the use of sealed keyword for class in inheritance and overriding


using System;
sealed class GrandParent
{
 public void Show()
 {
  Console.WriteLine("GrandParent Class Method");

Program to show the use of abstract keyword in Inheritance


using System;
abstract class Base
{
 public Base()
 {
  Console.WriteLine("Welcome in Base Class");

Program to demonstrate the use of virtual and override keyword


using System;
class GrandParent
{
 public virtual void Display()
 {

Thursday, 20 September 2012

Program for Programming Language Knowledge Test of C language in multiple choice


using System;
using System.Runtime.InteropServices;
class Test
{
 [DllImport ("msvcrt")]
 static extern char _getch();
static void Main()
{
 char c;
 Console.Write("This is your Programming Language Knowledge Test of C, developed in C# console application by The \"Amit Ranjan\".\n");
 Console.Write("There are 20 multiple Choice Question of 5 marks each.\n");