Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:37:36+00:00 2026-06-05T22:37:36+00:00

My PUMP can (inflate) my BALLOON. No problem! But when I try to use

  • 0

My PUMP can (inflate) my BALLOON. No problem! But when I try to use my PUMP to (pop) the BALLOON, it really doesn’t work very well. I can keep using my PUMP and, eventually, it will (pop) the balloon, but my arm is getting really tired, and I want to (pop) it now. So, instead, I get my POINTY STICK and (pop)! Of course, my POINT STICK is even less effective at (inflate)ing my BALLOON, than the PUMP is at (pop)ing it.

Class Balloon
{
    Private int _volume = 0;
    Private bool _popped = false;

    Public Balloon() { }

    //Restrict calling to only a PUMP object
    Internal Inflate()
    {
        if (_popped) return;

        _volume += 1;
        if (volume > 10) this.Pop();
    }

    //Restrict calling to only a POINTY STICK object
    Internal Pop()
    {
        if (!_popped) _popped = true;
    }

    Public string GirlHappiness
    { get
        {
        if (!_popped)
            {
            if (_volume < 3)
                return "......";
            if (_volume < 6)
                return "Ooohhh";                    
            else
                return "Ahhhh! Yay!";
            }
        else
            return "WaAaAaAaHhHhHh";
        }
    }

    Public string BoyHappiness
    { get
        {
        if (!_popped)
            {
            if (_volume < 3)
                return "zzzzzz";
            if (_volume < 6)
                return "zzzzzz";                    
            else
                return "zzzzzz";
            }
        else
            return "Ahahaha YAY!";
        }
    }
}

So, is there any way to achieve this? I cannot achieve the desired result via separating assemblies, and the other method I’ve explored, using reflection and tracing the stack, is unreliable outside of debugging. What to do?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:37:38+00:00Added an answer on June 5, 2026 at 10:37 pm

    Two ways that pop up in my mind: Use explicit interface implementation or events.

    With explicit interfaces, you hide the implementation for those who do not threat the instance ‘as is’. Example:

        interface IPumpable 
        {
            void Pump();
        }
        interface IPoppable
        {
            void Pop();
        }
    
        class Balloon :IPumpable, IPoppable
        {
            private void IPumpable.Pump()
            {
                throw new NotImplementedException();
            }   
            private void IPoppable.Pop()
            {
                throw new NotImplementedException();
            }
        }
    
        public static void PopMethod(IPoppable poppable)
        {
            poppable.Pop();
        }
        public static void PumpMethod(IPumpable pumpable)
        {
            pumpable.Pump();
        }
    
        static void Main(string[] args)
        {
            Balloon balloon = new Balloon();
    
            PumpMethod((IPumpable)balloon);
            PopMethod((IPoppable)balloon);
        }
    

    Note that the Pump and Pop implementations can be marked private. They are only visible when you threat the balloon as IPumpable or IPoppable respectively.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The source code looks very similar: pump , pipe . Why would I use
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
From what I have read being able to use pump mode with distcc requires
Can I do data pump exp (not expdp) from 11g db (source) then imp
I have a problem similar to this one: How can I execute code after
I am using simplexml to parse xml and I can get single node but
At work we've got a very CPU-intensive Windows Forms application. It's running on a
The UI thread in Winforms have the responsibility of running the message pump, by
I have a table like this: Name State Amount ------------------------------ Pump 1 Present 339
I'm looking for a way, preferably a command-line utility, to pump out an .abc

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.