Pattern name/Convention -> Class that merge different attributes from other classes

I wanted to know if there is a known pattern or convention for the following scenario:

I have two classes: MAT (name:String, address:String) & MATversion(type:String, version:int)

Now I have a DataGrid (DataTable) which will take a generic List of objects for the column mapping and data filling.

The columns should be name, type, version. (Which are distributed in MAT and MATversion)

So I create a class to make this work. This class will merge the needed properties from each class (MAT, MATversion).

-> MAT_MATversion (name:String, type:String, version:int).

Does there exist a naming convention for such an class like MAT_MATversion? Any pattern that mirrors that?

Thanks!

Answers


Is there any specific reason why the merged result has to be a unique class?

I'm assuming every MAT object has a single MATversion you can add a couple of custom properties who will return the type and version of the underlying MATversion object In C# this would result in something like this

public class MAT{
  public String name{ get;set;};
  public String adress{ get;set;};
  public MATversion myVersion;
  public String type {
    get{
      return myVersion.type;
    }
    set{
      myVersion.type = value;
    }
  }
  public int version {
    get{
      return myVersion.version;
    }
    set{
      myVersion.version = value;
    }
  }
}

I'm aware that this doesn't answer the question about design patterns, but I couldn't ask/suggest another approach in a comment since I don't have that right yet.


Need Your Help

Excel Worksheet SelectionChange event doesnt get fired firsr time but works second time

c# excel interop excel-addins

I have a winform dialog in my excel add-in, which is popped up on click of a panel button. I have a selection change event added to worksheet. The event is not being fired first time. I have to clo...

I want to integrate zk in jsp, But I have got Error

jsp zk

I am using ZK framework and I want to integrate zk in jsp.I have tried to run following code at server.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.