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 April 6th, 2006, 05:44 PM
Registered User
Join Date: Apr 2006
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

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

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