473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

class composition

sorry this may be a bit too generic for this newsgroup but neways:

I've got this:

class Event
{
reminder rem;
reccurance rec;
...other stuff;
}

When i need to check if a reminder needs to occur, i call
event.rem.checkreminder, however this function needs to access stuff in
the recurrance class. Obviously this can't happen.

I don't want to solve this problem with inheritence if possible, as
it's not really a logical modelling of the problem. And i also want to
avoid creating a function event.checkreminder, that passes "rec" to the
reminder class, as it doesn't make much sense either. Does anyone one
have some brilliant suggestions that will wash all my troubles away? :)

cheers!
dave

Nov 17 '05 #1
1 1362
David Sobey wrote:
sorry this may be a bit too generic for this newsgroup but neways:

I've got this:

class Event
{
reminder rem;
reccurance rec;
...other stuff;
}

When i need to check if a reminder needs to occur, i call
event.rem.checkreminder, however this function needs to access stuff in
the recurrance class. Obviously this can't happen.

I don't want to solve this problem with inheritence if possible, as
it's not really a logical modelling of the problem. And i also want to
avoid creating a function event.checkreminder, that passes "rec" to the
reminder class, as it doesn't make much sense either. Does anyone one
have some brilliant suggestions that will wash all my troubles away? :)

cheers!
dave


Not knowing what reccurance does vs reminder I'm a little in the dark
but shouldn't reminder be inside reccurance? Can a reminder exist
without a reccurance and vice versa?

Chris
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Dave | last post by:
Hi I'm making a 3D Engine which consists of the class C3DEngine. Part of this engine is a file loader, a class called CMeshLoader. I have made an instance of CMeshLoader in C3DEngine, ie...
15
by: Mon | last post by:
I am in the process of reorganizing my code and came across and I came across a problem, as described in the subject line of this posting. I have many classes that have instances of other classes...
6
by: JSheble | last post by:
I come from a Delphi background, and am currently trying to port or convert some of our Delphi classes to C#. I've got a good handle on basic class design, but am a bit lost with some of the more...
12
by: TS | last post by:
i have a question about this situation: i have a class that i use that i need to know 1 piece of data that exists in a different class. Im wondering is it wrong to add the property that i need...
4
by: Frederik Vanderhaegen | last post by:
Hi, Can anyone explain me the difference between aggregation and composition? I know that they both are "whole-part" relationships and that composition parts are destroyed when the composition...
1
by: Jodie | last post by:
Hi All, I have a question regarding about inheritance and member of the class. For example I have the class A and class B what is the situation that I need to define class B is base class of class...
1
by: tony | last post by:
Hello! I access the class MyComparer in this way. steel_post.Sort(new MeltPracDataComposition.Composition.MyComparer()); You can see the class definition for MyComparer below. As you can see...
2
by: Ninereeds | last post by:
I'm messing around with using mixin-layers (look for papers by Yannis Smaragdakis and Don Batory) to define data structures. One issue is that nodes tend to have pointers to other nodes - the...
1
by: Jennifer Jazz | last post by:
My question is regarding the mapping of Class diagram to the C++ coding. There are 3 realtions in Class diagram 1) Assosication 2) Composition 3) Aggregation (Weak Composition). ...
15
by: Bob Johnson | last post by:
I have a base class that must have a member variable populated by, and only by, derived classes. It appears that if I declare the variable as "internal protected" then the base class *can*...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.