Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 September 9th, 2003, 03:34 PM
Registered User
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Abstract classes

I'm having trouble implementing an abstract class in C#, and I can't figure out how to search for the right answer. I think my question boils down to: "Does the abstract class have to be part of the same assembly as derived classes?"

I have an abstract class and a derived class, and when I put them in the same assembly together, everything works great, so I know all of the basic syntax is correct. However, when I put the abstract class in a different assembly, my derived class goes crazy. For each method in the derived class, I get two errors - the first saying I have failed to implement an inherited abstract member, and the second on my override method saying it can't find an appropriate method to override.

It is clearly finding the right abstract class, since it's throwing errors for everything I am supposed to implement, but somehow it is not matching up the abstract members to my derived methods anymore. How can I make this work?

Thanks,
Julie

 
Old September 9th, 2003, 05:23 PM
Registered User
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

After a little more research, I've found the problem is only actually with methods I've declared as protected internal, which starts to make more sense for cross-assembly code breaking.

Now I'm not sure how to accomplish my goal - I was hoping to create an abstract class that represents my company's general coding standards, with some parts precoded and some marked as abstract for each class to implement. In this way, I'd be providing the class as a "contract" that each derived class must implement, but some standard code portions would already be provided. However, I'd really like some of the methods to have internal scope, and that's where things fall apart. Ideas?







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
Why abstract class can't be instantiated? anisurr C++ Programming 5 July 23rd, 2008 01:32 AM
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.