Wrox Programmer Forums
|
BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4
This is the forum to discuss the Wrox book Beginning Microsoft Visual C# 2008 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780470191354
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2010, 08:14 AM
Authorized User
 
Join Date: Mar 2010
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Default Ch10 p259: Implementing Interfaces in Classes!

Hi all,

Extract from the book:

Quote:
Interfaces members can also be implemented on bases classes:
Shouldn't they say derived classes??



Code:
public interface IMyinterface
{
    void DoSomething();
    void DoSomethingElse();
}
public class MyBaseClass
{
    public void DoSomething()
    {
    }
}

public class MyDerivedClass : MyBaseClass, IMyInterface
{
    public void DoSomethingElse()
    {
    }
}
MyBaseClass doesn't implement IMyInterface.
But MyDerivedClass does although it doesn't contain the implementation of the DoSomething() method (that MyBaseClass does!!).

How come it works without having MyBaseClass implementing IMyInterface???
And why MyDerivedClass doesn't contain a implementation for DoSomething()?? (Is it because of its Base Class?)

I tried to run the program and it does work. But yet I still don't get it!
Is anyone having the same issue??
 
Old May 16th, 2010, 08:46 AM
Authorized User
 
Join Date: Mar 2010
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Default

Nevermind, I figured it out!

Because MyDerivedClass inherits from MyBaseClass.

Sorry for the post and the question!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Abstract classes/Interfaces vasancer BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 October 22nd, 2008 02:06 PM
returning interfaces mike72 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 April 17th, 2008 05:53 AM
interfaces malli_kv2 Java Basics 1 April 23rd, 2007 05:21 AM
when implementing two interfaces ratheesh_param ASP.NET 1.x and 2.0 Application Design 5 November 10th, 2006 01:52 PM
Diffrences of Abstract Classes and Interfaces jimblanc Java Basics 4 September 4th, 2006 01:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.