Results 1 to 5 of 5

Thread: How to check the value of boolean variable

  1. #1
    Join Date
    Jun 2009
    Posts
    1,205

    How to check the value of boolean variable

    I have a boolean with the name "Kitchen", one whose name is "House."

    In a class Formula1 I have
    Kitchen = false;
    Room = true;

    by default in the constructor. House and Kitchen inherit Room. Although now I wish to make a method

    public boolean verifyAuthorization (Room s)

    and in this method I would like to know the value of boolean whose name is s.getClass().getName(). Basically if I send him a kitchen, I want to check if the boolean whose name is kitchen is true or false.

  2. #2
    Join Date
    Nov 2008
    Posts
    1,185

    re: How to check the value of boolean variable

    I think it has classes with the same name as Boolean stored in another class and the type of the class passed as parameter to a method implemented one knows where he wants to access a given boolean. In short, something twisted.

    So we can help you in advising a better design, we explain the role and functioning of your application and its overall structure.

  3. #3
    Join Date
    Jun 2009
    Posts
    1,205

    re: How to check the value of boolean variable

    Thank you for your answer, I simplified things. In fact I have a boolean whose name is a class name. So I'd like to arrive at this via a boolean string (actually via myObj.getClass().getName(). Basically if the object is an instance of Class Kitchen, I must watch the boolean whose name is Kitchen.

    I have a class Room whether it is a Kitchen, or a Room, depending on the type of contract from client. In class type1 I have Kitchen = false, for example, then how do I know if he can use the kitchen? The fact is that my application is extendable so I do not know all the classes. So actually I would check if my object Room is authorized for a client with a type of contract

  4. #4
    Join Date
    Nov 2008
    Posts
    996

    re: How to check the value of boolean variable

    What is your boolean? To say if the room is occupied for example? In this case, you create a boolean that holds in the class Room, and you can check inside. Make sure that this room is a kitchen or bedroom.

    What are the basic principles of inheritance in programming?

  5. #5
    Join Date
    Jun 2009
    Posts
    1,205

    re: How to check the value of boolean variable

    Boolean is not to say that in this particular type of contract, the user has the right to use the special room. How to know if the boolean in the kitchen typeSubscription class is a true or false by having the object name to be taken into account? I just want to know the syntax for writing

    boolean b = true
    String mystring = "b"

    if (mystring)

Similar Threads

  1. Check the temp enviroment variable
    By Landon in forum MS Office Support
    Replies: 10
    Last Post: 19-04-2014, 12:45 AM
  2. How to check if variable exists in C#
    By Hamlet in forum Software Development
    Replies: 3
    Last Post: 28-08-2009, 07:30 PM
  3. How do I check 'temp environment variable' in Word 07
    By Miltongomes in forum MS Office Support
    Replies: 1
    Last Post: 07-06-2009, 09:03 PM
  4. Replies: 5
    Last Post: 03-04-2009, 02:36 AM
  5. Check the temp environment variable
    By nehal_serpa in forum MS Office Support
    Replies: 1
    Last Post: 19-07-2008, 01:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,748,061.88058 seconds with 16 queries