Jump to content

Why Child class cannot read its own values?


Recommended Posts

Class A ->

Private Data: Q Ref and Cluster-A

Protected Member function: “Initialize” which is a dynamic dispatch, Creates a Queue and assign user defined values to Cluster-A

Private Member function: “Start Write” which calls “Write Information” every xx interval of times

Public Member function: “Write Information” which is a dynamic dispatch

Class B -> Inherits from Class A

Private Data: Cluster-B

Protected Member function: “Initialize” which is a dynamic dispatch, first calls the Parent Initialize and then assigns the User define value to Cluster-B

Public Member function: “Write Information” which is a dynamic dispatch

Class C -> Inherits from Class B

Private Data: A Numeric Control (default = -1) and a Boolean Control (default = False)

Protected Member function: “Initialize” which is a dynamic dispatch, pass the user defined values of Cluster-A and Cluster-B to Parent Class

Public Member function:

1. Write Information – Write the information from Queue to the file depending on the Numeric control, Boolean Control and Cluster-B data of Class B

2. Create - creates an object of class C + Calls Initialize to pass data to respective class

3. Set # – Assign the user defined value to Numeric Control

4. Read # – Read the value of Numeric Control

5. Set Bool – Assign the user define value to Boolean Control

6. Read Bool – Return the value of Boolean Control

Class D -> Inherits from Class B

Private Data: Empty

Protected Member function: “Initialize” which is a dynamic dispatch, pass the user defined values of Cluster-A and Cluster-B to Parent Class

Public Member function:

1. Write Information – Write the information from Queue to the file depending on the Cluster-B data of Class B

2. Create - creates an object of class D + Calls Initialize to pass data to respective class

My application,

Create Object C + Set # (to say 10) and

Create Object D

Object D - Write Information works fine

Object C - Write Information has Read # and Read Bool which always returns the default value.

Not able to understand why?

Any help is appreciated.

Thanks.

Edited by Vidula S
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.