Thread Subject: function call from sub class

Subject: function call from sub class

From: Syed

Date: 23 Oct, 2009 15:52:19

Message: 1 of 2

Hi!
I have an scenario where I need to count the number of object of main class. in sub class e.g., we have 4 classes.i.e. Wall, Room, House and City. City is the main class but it has one property Houses which is array of House object. Same like that Houses is having a property Rooms which is also an array of Room object and Room also have a property named walls which is also an array of wall object.

In my scenario, in walls class I need the total number of House objects present in the City class. How can I solve this problem? Where I have to define a method? I think I have to define a method in City class which returns the total length of the House property array. But how can I call this function in wall class?

Thanks in Advance.
/Hasan

Subject: function call from sub class

From: Matt

Date: 23 Oct, 2009 16:19:05

Message: 2 of 2


> But how can I call this function in wall class?
=====

By passing the City object as an argument to the Wall class method that needs this info.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
oop Matt J 23 Oct, 2009 12:21:12
function call i... Hasan Yousuf 23 Oct, 2009 11:54:23
classes Hasan Yousuf 23 Oct, 2009 11:54:23
object oriented Hasan Yousuf 23 Oct, 2009 11:54:23
rssFeed for this Thread

Contact us at files@mathworks.com