Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 4th, 2012, 10:54 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Abstract and Interface classes

Tell me or correct me if I am wrong here. If you have an abstract class, base class of "Vehicle" with a method of:
public abstract void setMySpeed();
It is a fact that the setMySpeed() function will never, ever be fired off in the abstract class, instead the derived of classes of the Vehicle are going to be forced to implement this method. So the best way to do this is to right click the setMySpeed(); method function and say Refractor ---> Extract interface to create an interface class like:
Code:
Namespace OOpsPractice
{
  interface ISpeed
  {
     void setMySpeed();
  }
}
Which has the effect of creating a new class called ISpeed.cs.

The purpose of this interface class is help force implementation in the derived classes of the abstract class of Vehicle?
Is this correct?

Are not abstract classes in C# very similar to Absolute Virtual base classes in C++?
 
Old May 5th, 2012, 03:16 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi vbboyd,

I asked this before, but please, please post this in a more general ASP.NET or .NET category since this is not directly related to my book. This way, you'll attract more viewers and increase your chance on an answer, and people that come here find it easier to look up book-related stuff.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





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
polymorphism and abstract classes elvisfeverr C++ Programming 3 October 16th, 2008 01:39 AM
interface and abstract class sreenu.pocha C# 2 July 26th, 2006 07:18 AM
Abstract classes guppyheart C# 1 September 9th, 2003 05:23 PM





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