Re: std::pair<,>

From: Jonathan Mcdougall (jonathanmcdougall_at_DELyahoo.ca)
Date: 10/04/03


Date: Fri, 3 Oct 2003 21:18:18 -0400


> > So, if you want a Point with members x and
> > y, why not subclass?
>
> Why not simply:
>
> std::pair<int,int> coord(x,y);
>
> or if you like:
>
> typedef std::pair<int,int> Point;
>
> Point coord(x,y);

The thig is

coord.first = 2;

is not quite representative, as opposed to

coord.x = 2;

Jonathan



Relevant Pages

  • Re: Help with design please
    ... entities from the problem space that are cohesive. ... disconnects in how the solution is viewed by different team members. ... >>relationships with the arrow on the superclass end. ... >>relationship the union of subclass members must be a complete set of the ...
    (comp.object)
  • Re: A hopefully interesting design question ...
    ... I will definitely look into the State Pattern ... AnswerBox: ... That is, members of OO ... it becomes obvious if one explicitly defines a subclass ...
    (comp.object)
  • Re: A hopefully interesting design question ...
    ... void RequestImputable; // from EditedAnswerBox ... AnswerBox: ... That is, members of OO ... it becomes obvious if one explicitly defines a subclass ...
    (comp.object)
  • Re: UML "OR" Composition Question
    ... "Each superclass instance in D must have exactly one ... from the fact that the union of subclass members must be a complete set ... of the superclass members. ... known in data modeling as a 'direct instance' of the superclass. ...
    (comp.object)
  • Re: UML "OR" Composition Question
    ... the union of members of sibling subsets must be a complete ... > instantiate a superclass without specifying a leaf subclass as well.] ... Since the diagram is only a view to the model, it needs not to show the ... siblings of Y, Z. Additionally, these additional siblings aren't ...
    (comp.object)