when I did the following porgram I got the error like
NewNamespace.Focusview does not implement interfaceNenamesapce.Iencrypt.Icompress
why? can any body explain this problem

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewNamespace
{
    interface IEncrypt
    {
        void IEencrypt();
        void Idecrypt();
    }
    interface Icompress
    {
        void compress();
        void decompress();
    }
    interface Iauth
    {
        void login();
        void logout();
    }

    public class FocusView : IEncrypt, Icompress, Iauth
    {
        void IEncrypt()
        {
            Console.WriteLine("encrypt");
        }
        void Idecrypt()
        {
            Console.WriteLine("Decrypt");
        }

        void login()
        {
            Console.WriteLine("login");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            FocusView o = new FocusView();
            IEncrypt ie = (IEncrypt)o;
            ie.IEencrypt();
            ie.Idecrypt();
        }
    }
}

the run time error is" newnamespace.focusfiew does not implement the interface newnamespace.iencrypt,icompress,iauth"

yo havent implemented all of your interfaces methods so far as i can see in the class FocusView you have implemented Idecrypt and login.

your IEncrypt method in FocusView is not implementing the method IEencrypt in the interface and you are missing, compress, decompress and logout

to implement an interface to your class you must initialise all of its methods.

public class FocusView : IEncrypt, Icompress, Iauth
{

  public void IEencrypt()
  {
    Console.WriteLine("encrypt");
  }
  public void Idecrypt()
  {
    Console.WriteLine("Decrypt");
  }

  public void compress()
  {
    Console.WriteLine("Compress");
  }
  public void decompress()
  {
    Console.WriteLine("Decompress");
  }

  public void login()
  {
    Console.WriteLine("login");
  }
  public void logout()
  {
    Console.WriteLine("login");
  }

}

on another note you need to implement your methods publicly else you are not implementing the interface as it is required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.