473,626 Members | 3,459 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 1298
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
3349
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 A_methods(self): ...
2
2185
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, game instances) as totally seperate classes and show them in totally seperate windows. Given my basic understanding of Twisted, I see no way of doing this, and my whole GUI is contained in one class. The project is doable this way, it would...
1
1652
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 sure what to search on... everything I search on just pops up the usual... -- Thanks a lot...
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 to set a variable, declared in CL_B, of type CL_A.A to another variable, declared in application, of same type CL_A.A it gives me following error though both types are same. error BC30311: Value of type 'CL_A.A' cannot be converted to 'CL_A.A'
3
1244
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 get this error message. considering that i am following a walkthrough i would like to iorn out this problem ASAP so i can continue... here is the error message: Compiler Error Message: CS1595: 'Temperature.TemperatureCB' is defined in
1
1531
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 class file (within the same project) but all classes are defined within the same namespace DaySpanLib. Now here's my question: given that the interface I need to develop will be implemented by several classes, each of which live in their own .cs...
3
3041
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
4691
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 each table. That class (possibly in combination with other classes on child elements) controls every part of the table - layout, colors, fonts, etc. Example: class="data" PROS: Easier to standardize, less specificity confusion, everything is...
4
2219
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 Class - Holds user properties. Has NO DB related methods (infact has NO methods, only properties lol) etc User Collection class - Holds a collection of user objects
2
7634
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 app.config file from the main project (my start-up project). My question is can each project look for its keys in its own config file first? Is there something or settings that missing here? Would some one give me a hand? Regards,
0
8268
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8641
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.