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 6756135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:29:18+00:00 2026-05-26T13:29:18+00:00

I am a java programmer who has started to make apps for iPhone. I

  • 0

I am a java programmer who has started to make apps for iPhone. I have stumbled with a problem. Supose the following code (in java):

Class 1 (building)

public abstract class Building
{
    public void Update()
    {
        specialAction();
    }

    public abstract void specialAction();
}

Class 2 (House)

public abstract class House extends Building
{   
    public abstract void specialAction()
    {
        System.out.println("Special Action Done");
    }
}

Runnable Class

public class Program
{   
    public void main(String[] args)
    {
        House h = new House();
        h.Update();
    }
}

When the Update method from House h (running from the superclass Building) is called in Program the method specialAction from House is called and thus the Console prints “Special Action Done”. My question is, would the following code in xcode be equivalent (in terms of inheritance and method overriding rather that console output):

Class 1 (building):
.h file:

-(void)Update;
-(void)SpecialAction;

.m file:

-(void)Update
{
    [self specialAction];
}

Class 2 (House, which extends or inherits from Building):
.m file:

-(void)SpecialAction
{
    NSLog("Special Action Done");
}

Runnable Class

House* h = [[House alloc] init];
[h Update];
  • 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-05-26T13:29:19+00:00Added an answer on May 26, 2026 at 1:29 pm

    Your example looks correct. A full program of your Java example is approximated in ObjC like so:

    /* Building.h */
    @interface Building : NSObject
    - (void)Update;
    - (void)specialAction;
    @end
    
    /* Building.m */
    @implementation Building
    
    - (void)Update
    {
        [self specialAction];
    }
    
    - (void)specialAction
    {
        assert(0 && "override required"); // << see note
    }
    
    @end
    
    /* House.h */
    @interface House : Building
    @end
    
    /* House.m */
    @implementation House
    
    - (void)specialAction
    {
        NSLog(@"Special Action Done");
    }
    
    @end
    
    void ProgramMain()
    {
        House * h = [House new];
        [h Update];
        [h release];
    }
    

    Formal abstract methods are not built into the language, but you can approximate it using protocols.

    You can consider all ObjC methods to be virtual.

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

Sidebar

Related Questions

Im a Java programmer, with a little C knowledge who wants to get started
I'm a Java programmer who started programming Ruby on Rails one year ago. I
I am a novice programmer who mainly uses Java. Recently I have become interested
I'm a Java programmer who has been trying to learn a bit of C++
I'm a Java programmer who is working on an iPhone application. I'd like it
I am a Java programmer, learning Objective-C and I have a problem with implementation
I'm originally a Java programmer who now works with Objective-C. I'd like to create
I am a Java programmer who learns Haskell. I've written a small program that
As the question states, i am a C#/Java programmer who is interested in (re)learning
I'm a .NET programmer who is soon moving to the Java EE world. I

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.