Solved

Simple CArray Question

Posted on 1998-08-19
3
198 Views
Last Modified: 2013-11-20
Does anyone know what is wrong with this code. I can get all the other operations for CArray to work, but the "Add" one  :

I have a class... say MyClass

     CArray<MyClass, int> x;
     MyClass y;

     x.Add(y);

What is wrong with the code above??
(SORRY, only had 11 points to give)


0
Comment
Question by:huya
3 Comments
 

Author Comment

by:huya
ID: 1321029
Edited text of question
0
 
LVL 23

Accepted Solution

by:
chensu earned 10 total points
ID: 1321030
CArray<MyClass, MyClass &> x;

template< class TYPE, class ARG_TYPE > class CArray : public CObject

ARG_TYPE   Template parameter specifying the argument type used to access objects stored in the array. Often a reference to TYPE. ARG_TYPE is a parameter that is passed to CArray.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1321031
Also make sure MyClass can be assigned (it won't if you simply derive from CObject), example - check this works

MyClass A ;
MyClass B ;

A = B ;


0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now