Results 1 to 6 of 6

Thread: Object Casting

  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Object Casting

    How these objects are cast ? like if we have an object of type Object and a class A having object B ; I can write like B = (A) object ... how these fields and functions of objects are wrapped into B ??

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Object Casting

    Have you already read the corresponding chapter of the JLS? Chapter*5.*Conversions and Promotions
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Object Casting

    nop ... just wanna know how it works

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,695
    Rep Power
    5

    Default Re: Object Casting

    Whole books have been filled trying to explain it, its too large a subject to cover in a forum post. You need a decent book about Java and read it front to back.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,348
    Blog Entries
    7
    Rep Power
    20

    Default Re: Object Casting

    Quote Originally Posted by allaudin View Post
    nop ... just wanna know how it works
    A very good reason to start studying that link; don't you think it isn't just a bit silly to ask questions that can be easily answered by reading? It doesn't make your eyeballs bleed.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    slider57 is offline Member
    Join Date
    Aug 2011
    Posts
    29
    Rep Power
    0

    Default Re: Object Casting

    maybe an adapter? I did a little research on adapters a while ago and they are used for incompatible classes to mesh with one another.

    Every now and then I would write a unary function override in c++ for my classes so instead of doing a shallow copy, they would do a deep copy.
    Last edited by slider57; 07-25-2013 at 07:11 PM.

Similar Threads

  1. Need help with Object Casting
    By Elaforestis in forum New To Java
    Replies: 6
    Last Post: 10-17-2012, 10:05 PM
  2. Casting a String object to a Form object
    By kakinyim in forum CLDC and MIDP
    Replies: 0
    Last Post: 04-23-2011, 11:41 AM
  3. Object Casting, please help
    By DerekRaimann in forum New To Java
    Replies: 5
    Last Post: 12-04-2010, 01:14 PM
  4. Object casting
    By spiderweb in forum Advanced Java
    Replies: 5
    Last Post: 08-20-2009, 05:43 PM
  5. Object to Int casting
    By nn12 in forum New To Java
    Replies: 4
    Last Post: 12-06-2008, 10:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •