Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Inherited Method

Status
Not open for further replies.

thepsion5

Programmer
Aug 31, 2006
4
US
Hi guys,

I have a interface that implements/extends the generic collections interface, like so:
Code:
public class RawTrafficDataBuffer : IRawDataBuffer

The implementing class implements all the required methods the way I believe is proper for C# (I say this because the function calls were generated by Visual Studio) in the implemented class:
Code:
public class RawTrafficDataBuffer : IRawDataBuffer
{
    ICollection<RawTrafficDatagram>.Add(RawTrafficDatagram Item)
    {
    ...
    }

int ICollection<RawTrafficDatagram>.Count
    {
        get{ ... }
    }
}

But how do I call these functions from the implementing class? Calling these methods or properties from an instance of RawTrafficDataBuffer gives me a compilation error, and so far I haven't been able to figure out what I'm doing wrong. Thanks in advance for the help!
-Sean
 
You did not specify an access modifier for the methods (i.e. private, public or protected) so they are by default “private”. That is way you can’t access then using a reference to the class. Add the key word public in the front of each method and you will be fine

Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top