Click here to Skip to main content
15,917,473 members
Home / Discussions / C#
   

C#

 
AnswerRe: I have string[] names = {"name1", "name2"} ... Pin
André Ziegler21-Nov-05 12:39
André Ziegler21-Nov-05 12:39 
QuestionUnmanaged Thread Unsafe Library Pin
BenjaminWalker21-Nov-05 10:49
BenjaminWalker21-Nov-05 10:49 
Questiona common serialization question Pin
mattraffel21-Nov-05 10:43
mattraffel21-Nov-05 10:43 
AnswerRe: a common serialization question Pin
Tom Wright21-Nov-05 10:58
Tom Wright21-Nov-05 10:58 
GeneralRe: a common serialization question Pin
mattraffel21-Nov-05 11:03
mattraffel21-Nov-05 11:03 
GeneralRe: a common serialization question Pin
Curtis Schlak.21-Nov-05 16:42
Curtis Schlak.21-Nov-05 16:42 
Questionquestion about interfaces Pin
savage_21-Nov-05 10:02
savage_21-Nov-05 10:02 
AnswerRe: question about interfaces Pin
Steve Maier21-Nov-05 10:46
professionalSteve Maier21-Nov-05 10:46 
What about just expanding your sample here.....

<code>interface IVehicle
{
    void Start();
}

class Car : IVehicle
{
    public Car() { }
    public void Start() { Console.WriteLine("starting Car..."); }
}

class Truck : IVehicle
{
    public Truck() { }
    public void Start() { Console.WriteLine("starting Truck..."); }
}

--test class--
void StartVehicle(IVehicle vehicle)
{
    vehicle.Start();
}

void Main()
{
    Car myCar = new Car();
    IVehicle vehicle = (IVehicle)myCar;

    Truck myTruck = new Truck();
    IVehicle vehicle2 = (IVehicle)myTruck;

    StartVehicle(vehicle);
    StartVehicle(vehicle2);

}</code>

This way a function that can take any type of vehicle can be used on either a Car or a Truck.

Steve Maier, MCSD MCAD
GeneralRe: question about interfaces Pin
savage_21-Nov-05 11:55
savage_21-Nov-05 11:55 
QuestionProject Configuration Pin
monrobot1321-Nov-05 9:34
monrobot1321-Nov-05 9:34 
QuestionMemory used by an object Pin
Joe Woodbury21-Nov-05 8:52
professionalJoe Woodbury21-Nov-05 8:52 
QuestionHEL.... P HEL....p p Pin
7mam21-Nov-05 8:41
7mam21-Nov-05 8:41 
AnswerRe: HEL.... P HEL....p p Pin
KaptinKrunch21-Nov-05 8:54
KaptinKrunch21-Nov-05 8:54 
GeneralRe: HEL.... P HEL....p p Pin
7mam21-Nov-05 10:24
7mam21-Nov-05 10:24 
GeneralRe: HEL.... P HEL....p p Pin
Tom Wright21-Nov-05 11:02
Tom Wright21-Nov-05 11:02 
QuestionXML serialization-dynamic value retrieval Pin
subbucs21-Nov-05 6:56
subbucs21-Nov-05 6:56 
QuestionCan't access commandline args - Permissions problem Pin
CarolAnnLove21-Nov-05 6:46
CarolAnnLove21-Nov-05 6:46 
AnswerRe: Can't access commandline args - Permissions problem Pin
KaptinKrunch21-Nov-05 8:58
KaptinKrunch21-Nov-05 8:58 
QuestionHelp needed for Array Class Pin
Nuray21-Nov-05 3:58
Nuray21-Nov-05 3:58 
AnswerRe: Help needed for Array Class Pin
S. Senthil Kumar21-Nov-05 4:22
S. Senthil Kumar21-Nov-05 4:22 
GeneralRe: Help needed for Array Class Pin
Nuray21-Nov-05 4:25
Nuray21-Nov-05 4:25 
GeneralRe: Help needed for Array Class Pin
S. Senthil Kumar21-Nov-05 4:57
S. Senthil Kumar21-Nov-05 4:57 
GeneralRe: Help needed for Array Class Pin
Nuray21-Nov-05 5:06
Nuray21-Nov-05 5:06 
GeneralRe: Help needed for Array Class Pin
Judah Gabriel Himango21-Nov-05 5:20
sponsorJudah Gabriel Himango21-Nov-05 5:20 
GeneralRe: Help needed for Array Class Pin
Nuray21-Nov-05 5:31
Nuray21-Nov-05 5:31 

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.