Click here to Skip to main content
15,922,166 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to call a base class method? [modified] Pin
PIEBALDconsult18-Jan-08 14:58
mvePIEBALDconsult18-Jan-08 14:58 
GeneralRe: How to call a base class method? Pin
Colin Angus Mackay18-Jan-08 15:05
Colin Angus Mackay18-Jan-08 15:05 
GeneralRe: How to call a base class method? Pin
PIEBALDconsult18-Jan-08 15:19
mvePIEBALDconsult18-Jan-08 15:19 
GeneralRe: How to call a base class method? Pin
Miszou18-Jan-08 16:38
Miszou18-Jan-08 16:38 
GeneralA problem with casting Pin
Clive D. Pottinger18-Jan-08 13:27
Clive D. Pottinger18-Jan-08 13:27 
GeneralRe: A problem with casting Pin
Ed.Poore18-Jan-08 13:57
Ed.Poore18-Jan-08 13:57 
GeneralRe: A problem with casting Pin
Luc Pattyn18-Jan-08 14:14
sitebuilderLuc Pattyn18-Jan-08 14:14 
GeneralRe: A problem with casting Pin
J$18-Jan-08 14:18
J$18-Jan-08 14:18 
It seems to me that your Automobile class should have a DriveHome() method. Since the classes Truck and Van are derived from Automobile, they would be able to use the DriveHome method declared in Automobile.

If the outcome of DriveHome() is going to be different depending on whether your object is a Truck or if it is a Van, then in your Automobile class, when you declare your DriveHome() method, declare it as virtual
public virtual void DriveHome()<br />
{<br />
  // Do some stuff<br />
}


Then, in your Truck class for example you could override the DriveHome() method to customize it specifically for the Truck's situation
public override void DriveHome()<br />
{<br />
  // Am I helping a friend move?<br />
  if (IAmHelpingFriendMove)<br />
  {<br />
    //Don't go home until I'm done<br />
  }<br />
<br />
  //Call the DriveHome method in the Automobile class to drive home, <br />
  //or, if you need to, you can still implement your own custom DriveHome()<br />
  //method without calling base.DriveHome()<br />
  base.DriveHome()<br />
}


Hope that helps you out a bit...
GeneralRe: A problem with casting Pin
PIEBALDconsult18-Jan-08 15:33
mvePIEBALDconsult18-Jan-08 15:33 
GeneralRe: A problem with casting Pin
Clive D. Pottinger19-Jan-08 5:05
Clive D. Pottinger19-Jan-08 5:05 
GeneralProblem wyth colors (uint, hexa) Pin
alayle18-Jan-08 12:37
alayle18-Jan-08 12:37 
GeneralRe: Problem wyth colors (uint, hexa) Pin
Luc Pattyn18-Jan-08 13:09
sitebuilderLuc Pattyn18-Jan-08 13:09 
QuestionADO.net: How to omit Columns from a DataTable in a DataGridView??? Pin
dergunnar18-Jan-08 10:14
dergunnar18-Jan-08 10:14 
AnswerRe: ADO.net: How to omit Columns from a DataTable in a DataGridView??? Pin
Gareth H18-Jan-08 10:27
Gareth H18-Jan-08 10:27 
AnswerRe: ADO.net: How to omit Columns from a DataTable in a DataGridView??? Pin
ChrisKo18-Jan-08 11:04
ChrisKo18-Jan-08 11:04 
AnswerRe: ADO.net: How to omit Columns from a DataTable in a DataGridView??? Pin
dergunnar18-Jan-08 12:44
dergunnar18-Jan-08 12:44 
GeneralDrawing Circle and picture in that Pin
alishazdeh18-Jan-08 9:48
alishazdeh18-Jan-08 9:48 
GeneralRe: Drawing Circle and picture in that Pin
Ennis Ray Lynch, Jr.18-Jan-08 9:54
Ennis Ray Lynch, Jr.18-Jan-08 9:54 
GeneralDataSet Pin
simworld18-Jan-08 9:44
simworld18-Jan-08 9:44 
GeneralRe: DataSet Pin
PIEBALDconsult18-Jan-08 9:49
mvePIEBALDconsult18-Jan-08 9:49 
GeneralRe: DataSet Pin
simworld19-Jan-08 8:26
simworld19-Jan-08 8:26 
GeneralPrint Preview in landscape Pin
Christian Graus18-Jan-08 9:21
protectorChristian Graus18-Jan-08 9:21 
GeneralRe: Print Preview in landscape Pin
Luc Pattyn18-Jan-08 10:17
sitebuilderLuc Pattyn18-Jan-08 10:17 
GeneralRe: Print Preview in landscape Pin
Christian Graus18-Jan-08 10:28
protectorChristian Graus18-Jan-08 10:28 
Questionhow objects use memory Pin
netJP12L18-Jan-08 8:52
netJP12L18-Jan-08 8:52 

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.