473,499 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple class in a map

1 New Member
Expand|Select|Wrap|Line Numbers
  1. Class1 {
  2.         public:
  3.             int value;
  4.             Class1(int value) {
  5.                 this->value = value;
  6.             }
  7.             Class1();
  8. }
  9.  
  10. Class2 : public Class1 {
  11.     public:
  12.         int value2;
  13.         Class2();
  14.         Class2(int value1, int value2) :         Class1(value1) { this->value2=value2
  15. }
  16. }
i want use like this for that what can i do ...

std::map<class, Class2> map_Class;
Jul 18 '12 #1
1 1287
Banfa
9,065 Recognized Expert Moderator Expert
Should work as you have it more or less, you might want give class1 a default constructor for the class2 default constructor to call.
Jul 20 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3345
by: YoTuco | last post by:
Does (can) an inheritance scheme like this have any adverse effects (pitt-falls) for the App class inheriting class 'A' twice? Thanx in advance for your input. class A: A_attr = 'A' ... def...
2
2179
by: Qp | last post by:
Is this even possible? I'm designing a simple chat and game client/server as an intro to Python, and it would be nice to represent the different interfaces (public chat room, private chat rooms,...
1
1649
by: Richard R Plourde | last post by:
Anyone know where I can see the correct use of div's with multiple classes specified. I thought I'd read a Tantek responce showing this somewhere and now I can't seem to get back there... not...
1
335
by: TF | last post by:
I am developing a Windows Application in VB.NET that is using two class libraries CL_A (contains class A) & CL_B (contains class B). Also CL_A is used in CL_B. Now in my application when i try...
3
1236
by: david | last post by:
i am doing the walkthrough of an asp.net book and i have come to one of the tutorials where i am supposed to create a simple code behind method. but, when i follow the instructions in the book i...
1
1520
by: Hans De Schrijver | last post by:
I'm new to C# development, so here's a basic question. I'm developing a code library (no UI) where several of the classes will implement an IPersistable interface. Each class lives in its own...
3
3026
by: Elroyskimms | last post by:
I know that multiple class inheritance is not possible in VB.Net I also know that I can: inherit class a and in class a: inherit class b and in class b:
4
4669
by: Matt Kruse | last post by:
While developing an internal IE6-only webapp, a discussion started about the 'best' way to apply classes to data tables across multiple pages. The two arguments were: 1. Apply a single class to...
4
2209
by: vze1r2ht | last post by:
I have many types of classes and I'm deciding whether to use a single class or multiple classes for EACH type of class. For an example: User class has 3 classes associated with it: User...
2
7618
by: Sam | last post by:
Hi All, I have a solution which consists of multiple projects and each of these projects has their own app.config file. The problem is that all of my projects in the solution pull keys from the...
0
7134
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
7229
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...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.