Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2006, 05:44 PM
Registered User
 
Join Date: Apr 2006
Location: Long Beach, NY, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gmontanaro
Default Method calls within same class w/Interface

In the following code snippet, the ITest interface function "Paint()" is being implemented in the TestPaint class. I'm trying to see if I can call the class's implementation of Paint() from another function without creating an instance of ITest.
Is this possible?


namespace WindowsApplication1
{
    interface ITest
    {
        void Paint();
    }

    public class TestPaint : ITest
    {
        void ITest.Paint()
        {
            System.Windows.Forms.MessageBox("Paint called");
        }

        public void TestPaint()
        {
            ITest interfaceOfTest; //Don't want to have to
            interfaceOfTest = (ITest)this; //do all this just to
            interfaceOfTest.Paint(); //call TestPaint.Paint()
        }
    }
}

^-^_^-^_^-^_^-^_^-^_^
  Gabriel Montanaro
^-^_^-^_^-^_^-^_^-^_^
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
program that calls its method automatically mfahadwallam Java Basics 3 January 29th, 2008 06:50 AM
Proxy class method calls: No error, No data! corin .NET Web Services 0 September 11th, 2006 08:33 PM
object parameters to remote method calls DotNetJunk General .NET 1 April 29th, 2005 04:02 AM
how to achieve static method in an interface? cfouquet C# 3 September 28th, 2004 08:59 AM
Third party program library method calls invocatio yeeck VB Components 0 June 20th, 2003 01:33 AM



All times are GMT -4. The time now is 01:44 PM.


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