954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

implement Interface

Hi i have been working on this code for a long time but i keep on getting the same error:

Type Expected
Invalid token '{' in class, struct, or interface member declaration

the code is something like this:

//vehicle.cs
namespace ConsoleApplication3
{
    interface vehicle
    {
        void displayName();


    }
}

//Car.cs

namespace ConsoleApplication3
{
    class Car : public vehicle
    {
        void displayName() 
        { 
        }
    }
}


can someone be kind to explain to me why and help me solve this problem? thanks a lot..

wen30
Newbie Poster
7 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

Leave out a public keyword like this:

interface vehicle { void displayName();}
        class Car : vehicle    
        {        
            void displayName()         
            {         
            }    
        }
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: