Click here to Skip to main content
15,894,017 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Connecting Sql Server Pin
SeMartens29-Sep-10 22:18
SeMartens29-Sep-10 22:18 
AnswerRe: Connecting Sql Server Pin
Gamzun2-Oct-10 1:12
Gamzun2-Oct-10 1:12 
GeneralRe: Connecting Sql Server Pin
vijaylumar2-Oct-10 1:43
vijaylumar2-Oct-10 1:43 
GeneralRe: Connecting Sql Server Pin
Gamzun3-Oct-10 10:20
Gamzun3-Oct-10 10:20 
QuestionInheritance Pin
future383929-Sep-10 4:09
future383929-Sep-10 4:09 
AnswerRe: Inheritance [Longish Post] Pin
Keith Barrow29-Sep-10 21:48
professionalKeith Barrow29-Sep-10 21:48 
GeneralRe: Inheritance [Longish Post] Pin
future383930-Sep-10 4:19
future383930-Sep-10 4:19 
GeneralRe: Inheritance [Longish Post] Pin
Keith Barrow30-Sep-10 9:39
professionalKeith Barrow30-Sep-10 9:39 
An Interface just defines what Methods / Properties / Events etc must be publicly available, how to achieve it is the responsibility of the class. So the person Interface might look like:

public Interface IPerson
{
   int Id { set; get; }
   int Name { set; get; }
   int PassportNumber { set; get; }
   int Nationality { set; get; }
   void SomeFictionalMethod();
}


Note that the Interface declares public members, so you don't (in fact can't) state the visibilty. You can Generate a Interface by right-clicking on the class name --> Reafactor --> Extract interface.

You don't have to use an Interface, but it is good practise. I can't think of a meaningful explanation for your example, so here's a simplified one. Let's say you have need to model modes of transport, that all expose two methods Go And Stop. A horse is a mode of transport, but so is a car, the implementation of these would be totally different so a common base class doesn't make sense. The solution that makes the most symantic sense is to create and IModeOfTransport interface and have both the Horse and Car implement it. Now let's suppose your Person object needs a ModeOfTransportProperty you can Declare it:

public class Person : IPerson
{
  // Snip.....
  public IModeOfTransport {get; set;}
  // Snip.....
}


Now you can pass any object in the inherits from IModeOfTransport, even if they don't have the same base class, this help to decouple the code.

QuestionAsp.net Cross Page Post Back issue Pin
AndieDu28-Sep-10 20:44
AndieDu28-Sep-10 20:44 
AnswerRe: Asp.net Cross Page Post Back issue Pin
Not Active29-Sep-10 2:43
mentorNot Active29-Sep-10 2:43 
GeneralRe: Asp.net Cross Page Post Back issue Pin
AndieDu29-Sep-10 13:36
AndieDu29-Sep-10 13:36 
QuestionWhich approach is faster ? calculate Image size in Server or Client ? Pin
Nadia Monalisa28-Sep-10 19:40
Nadia Monalisa28-Sep-10 19:40 
AnswerRe: Which approach is faster ? calculate Image size in Server or Client ? Pin
vaghelabhavesh29-Sep-10 18:08
vaghelabhavesh29-Sep-10 18:08 
GeneralRe: Which approach is faster ? calculate Image size in Server or Client ? Pin
Nadia Monalisa29-Sep-10 19:05
Nadia Monalisa29-Sep-10 19:05 
QuestionAsynchronous webmethods Pin
david vermeulen28-Sep-10 19:19
david vermeulen28-Sep-10 19:19 
AnswerRe: Asynchronous webmethods Pin
Not Active29-Sep-10 2:51
mentorNot Active29-Sep-10 2:51 
AnswerRe: Asynchronous webmethods Pin
NeverHeardOfMe29-Sep-10 3:54
NeverHeardOfMe29-Sep-10 3:54 
QuestionPost via email Pin
Jassim Rahma28-Sep-10 12:35
Jassim Rahma28-Sep-10 12:35 
QuestionNavigationURL question Pin
Jassim Rahma28-Sep-10 12:26
Jassim Rahma28-Sep-10 12:26 
AnswerRe: NavigationURL question Pin
Not Active28-Sep-10 13:49
mentorNot Active28-Sep-10 13:49 
QuestionExpires question Pin
Jassim Rahma28-Sep-10 10:46
Jassim Rahma28-Sep-10 10:46 
AnswerRe: Expires question Pin
thatraja28-Nov-10 1:24
professionalthatraja28-Nov-10 1:24 
Questionabout configuration file Pin
Dhyanga28-Sep-10 5:52
Dhyanga28-Sep-10 5:52 
AnswerRe: about configuration file Pin
JHizzle28-Sep-10 6:04
JHizzle28-Sep-10 6:04 
GeneralRe: about configuration file Pin
Dhyanga28-Sep-10 6:08
Dhyanga28-Sep-10 6:08 

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.