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

  • Home
  • SEARCH
  • 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 9031937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:51:21+00:00 2026-06-16T07:51:21+00:00

I have a two classes User Profile and FingerprintProfile which extend an abstract class

  • 0

I have a two classes “User Profile” and “FingerprintProfile” which extend an abstract class “Profile”.

Profile:

/**
 * Template for User profiles or Fingerprint profiles
 */
public abstract class Profile {

    /**
     * Profile Name
     */
    private String name;

    /**
     * Profile id
     */
    private int id;

    /**
     * Set the name of this profile
     * @param name
     */
    public void setProfileName(String name) {
        this.name = name;
    }

    /**
     * Set the id of this profile
     * @param name
     */
    public void setIdNumber(int id) {
        this.id = id;
    }

    /**
     * Get the name of this profile
     */
    public String getProfileName() {

        return name;

    }

    /**
     * Get the id of this profile
     */
    public int getIdNumber() {
        return id;
    }

}

My next class is UserProfile

public class UserProfile extends Profile {

    /**
     * Users password
     */
    private char[] password;

    /**
     * Set User password
     * @param password
     */
    public void setPassword(char[] password){

        this.password = password;

    }

    /**
     * Get User password
     */
    public char[] getPassword(){

        return password;

    }

}

Just looking at this class seems dodgy, it seems totally wrong to be able to retrieve the password like this (Even if the get method is private).

It seems like I will be facing the same problem when making my FingerPrintProfile class as well as that holds a “FingerprintData” Object which inherently also needs to be secure.

Does anybody know of a secure method, or preferably a pattern which people use to solve a scenario such as this one?

Thanks !

Bonus Question

I made the abstract class to provide a template for both types of profile, and it seems there is a common ground between the fingerprint data and the text password. However, it is not possible to make an abstract field “password” which can potentially be a char array or a FingerprintData object. Any ideas??

  • 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-16T07:51:22+00:00Added an answer on June 16, 2026 at 7:51 am

    Use “object thinking” instead. Your current design is not OOP at all. Instead of setting and getting the password you should expose behavior of the profile. For example:

    interface Profile {
      void rename(String name);
      String identity();
      boolean authenticate(char[] password)
    }
    

    Getters/setters is an anti-pattern in OOP.

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

Sidebar

Related Questions

I have two classes, user and role, defined as: public class User : Entity
I have two classes (MVC view model) which inherits from one abstract base class.
I have two following classes: public class User { public virtual Guid Id {
I have two classes class Facebook { String fid String name User user static
I have two classes: User : /** @Entity @Table(name=users) */ class User { /**
I have two classes declared as below: class User { public: MyMessageBox dataMsgBox; };
I have two classes (just recreating the problem): public class User { public virtual
I have two classes. UserModel and UserController. file: localhost/controllers/user.controller.php <?php class UserController { public
I have two classes and mapping for the collection: class User { Guid ID;
I have two classes: class User < ActiveRecord::Base :has_one :foo end class Foo <

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.