Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
GeneralRe: the main class in C# Pin
Colin Angus Mackay24-Apr-08 7:50
Colin Angus Mackay24-Apr-08 7:50 
GeneralRe: the main class in C# Pin
Jasmine250124-Apr-08 8:51
Jasmine250124-Apr-08 8:51 
GeneralRe: the main class in C# Pin
Colin Angus Mackay24-Apr-08 7:51
Colin Angus Mackay24-Apr-08 7:51 
GeneralRe: the main class in C# Pin
PIEBALDconsult24-Apr-08 8:51
mvePIEBALDconsult24-Apr-08 8:51 
JokeRe: the main class in C# Pin
Guffa24-Apr-08 9:29
Guffa24-Apr-08 9:29 
GeneralRe: the main class in C# Pin
Vikram A Punathambekar24-Apr-08 19:03
Vikram A Punathambekar24-Apr-08 19:03 
Questionwhat is meant by Interface in C#? Pin
A@YZ24-Apr-08 6:29
A@YZ24-Apr-08 6:29 
AnswerRe: what is meant by Interface in C#? Pin
johnnycantcode24-Apr-08 6:41
johnnycantcode24-Apr-08 6:41 
Interfaces in C# are a way of abstraction. For instance lets say we create an interface called IAnimal. The IAnimal interface defines a contract that all classes which implement the IAnimal interface must abide by. The IAnimal interface defines several properties such as int NumberOfLegs, bool HasFur and so on. Now you want to create a calls that implements this interface you would do so by

public class Dog : IAnimal
{

}

When you implement the IAnimal interface you MUST implement all of the items the interface defines so you would need to do this:

public class Dog : IAnimal
{
public int NumberOfLegs
{
get { return 4; }
}

public bool HasFur
{
get { return true; }
}
}

now you can not only refer to the instance of the Dog class as a Dog but you would also refer to this object as an IAnimal.

Dog dog = new Dog();
int legs = dog.NumberOfLegs;

or

IAnimal animal = new Dog();
int legs = animal.NumberOfLegs;

Hope this helps.

You can always find more at www.johnnycantcode.com

Scott "Johnny" Smith
www.johnnycantcode.com
AnswerRe: what is meant by Interface in C#? Pin
Gareth H24-Apr-08 6:57
Gareth H24-Apr-08 6:57 
QuestionMultiple Inheritance is possible in C# are not? Pin
A@YZ24-Apr-08 6:26
A@YZ24-Apr-08 6:26 
AnswerRe: Multiple Inheritance is possible in C# are not? Pin
Gareth H24-Apr-08 6:45
Gareth H24-Apr-08 6:45 
AnswerRe: Multiple Inheritance is possible in C# are not? Pin
Guffa24-Apr-08 9:13
Guffa24-Apr-08 9:13 
QuestionMultiple Inheritance is possible in C# are not? Pin
A@YZ24-Apr-08 6:25
A@YZ24-Apr-08 6:25 
GeneralRe: double post - see above Pin
Gareth H24-Apr-08 6:47
Gareth H24-Apr-08 6:47 
GeneralRe: Multiple Inheritance is possible in C# are not? Pin
Anthony Mushrow24-Apr-08 6:49
professionalAnthony Mushrow24-Apr-08 6:49 
QuestionAdd a button to FlowLayoutPanel at a specified location Pin
TurboNext24-Apr-08 6:10
TurboNext24-Apr-08 6:10 
GeneralRe: Add a button to FlowLayoutPanel at a specified location Pin
Anthony Mushrow24-Apr-08 6:48
professionalAnthony Mushrow24-Apr-08 6:48 
QuestionHow can I show different value when mouse over custom textbox? Pin
tantja24-Apr-08 4:28
tantja24-Apr-08 4:28 
AnswerRe: How can I show different value when mouse over custom textbox? Pin
Anthony Mushrow24-Apr-08 5:25
professionalAnthony Mushrow24-Apr-08 5:25 
GeneralShell.Run Pin
mihai12324-Apr-08 4:00
mihai12324-Apr-08 4:00 
QuestionRe: Shell.Run Pin
carbon_golem24-Apr-08 4:32
carbon_golem24-Apr-08 4:32 
GeneralRe: Shell.Run Pin
mihai12324-Apr-08 7:32
mihai12324-Apr-08 7:32 
GeneralRe: Shell.Run Pin
Thomas Stockwell25-Apr-08 14:12
professionalThomas Stockwell25-Apr-08 14:12 
Generalurgent.. help plzz Pin
hhani24-Apr-08 3:50
hhani24-Apr-08 3:50 
GeneralRe: urgent.. help plzz Pin
J4amieC24-Apr-08 3:53
J4amieC24-Apr-08 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.