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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:06:40+00:00 2026-05-28T08:06:40+00:00

I have some sub classes and one base. Base is movie , and I

  • 0

I have some sub classes and one base.
Base is movie, and I would like to call the method in the Fiction method which is sub-class.
The method will be called from other method called (management.java).
Fiction has its own field called typeOfmovie and getter and setter method.
What I’m trying to do is, I would like to call that getter or setter method.
But even if I create like:

Movie m = new Fiction();

I cannot call getter or setter method from there.
The only way is I should create abstract method in the movie class?
I could, but as the number of fields getting bigger, I thought the base class might get messy.

Is that only way I can do?

Also, the field is package private (default), but I still cannot access that way either
Can you give me an advice please?

Thanks

  • 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-28T08:06:40+00:00Added an answer on May 28, 2026 at 8:06 am

    Your Declaration say’s m is of type movie , so it can call methods that are declared in Movie only ( if any of base class methods overridden in your subclass, then overridden method code will be executed ). But if You want to call extra methods in subclass .You have to create your object like this

    Fiction f = new Fiction();

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

Sidebar

Related Questions

I have some XML which contains records and sub records, like this: <data> <record
I have a base class which adds some functionality to a number of derived
So, I have a base class which has a private locking object like so:
I have refactored some UIView sub-classes into a static library. However, when using Interface
I have some ASP.NET web services which all share a common helper class they
At work we have a base class, let's call it IntrusiveBase, that acts something
If I have minimum 2 classes. One class creates the Bitmap and the other
I have a two windows forms classes, a base class and a derived class.
I have a base class ReportElement which has type property: public abstract class ReportElement
I have list of categories , some have sub-category and some have sub-sub-category which

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.