527 Posted Topics

Member Avatar for kneiel

Through experimentation, I found that this is also legal-- [code=c++] #include <iostream> class Base { public: virtual void fn(){std::cout<<"fn base\n" << std::endl;} virtual void myfn(){std::cout<<"myfn base\n" << std::endl;} }; class Derived : private Base { private: void fn(){std::cout<<"der\n" << std::endl;} void myfn(){std::cout<<"myfn Derived\n" << std::endl;} }; int main(){ Derived d; …

Member Avatar for Alex Edwards
0
174
Member Avatar for CoolGamer48

This thread reminds me of [URL="http://www.daniweb.com/forums/thread129415.html"]http://www.daniweb.com/forums/thread129415.html[/URL]

Member Avatar for William Hemsworth
0
185
Member Avatar for sciwizeh

Why not encapsulate what produces the sound in a thread and execute multiple versions of the thread (where upon initialization, you specify a String for the file to read to get the .wav file to play)? Edit: Oh I just noticed you're producing sound based on numbers and not a …

Member Avatar for sciwizeh
0
123
Member Avatar for arupa

[QUOTE=selvaganapathy;670734]I think Bitwise & operator can be useful. No & 2 == 0 means Odd and No & 2 == 2 means Even (here No is any number) Is this correct? I think it also using condition but different approach rather than modulus[/QUOTE] Though zero isn't an even number, it's …

Member Avatar for arupa
0
180
Member Avatar for Dio1080

A few questions... First, why do you declare two arrays and define them full of spaces then iterate them through loops to assign space characters to them when they already have that value? You can reduce code-bloat by simply instantiating your arrays to have 12x12 characters. Furthermore the initial value …

Member Avatar for Alex Edwards
0
143
Member Avatar for atish00

I think you need to be more concise with the requirements. You have 30 strings correct? Does this mean that they each cannot be more than 20 characters long (including the null terminator)? You must make your char[20][30] (or most likely char[30][20]) in pointer form, then convert it into an …

Member Avatar for Salem
0
324
Member Avatar for esy928

Why not store the current time in a data type (like a long) when the key is pressed and when the key is released subtract the new time from the old time?

Member Avatar for esy928
0
155
Member Avatar for Dan_AlfaRomeo

Most companies that I know that use Cobol are moving towards Java. I'd guess that being, strictly a Java developer would be much more ideal in America, though I do not know about anywhere else. Then again if you want to companies migrating from Cobol to Java you would probably …

Member Avatar for Salem
0
91
Member Avatar for Alex Edwards

Is there any real different between using an union between two types and a reinterpret_cast between two types, for example-- [code=c++] #include <iostream> int main(){ union{ unsigned short *a; float *b; }; float value = 0.6f; b = &value; std::cout << *a << std::endl; unsigned short *s; float *f; f …

Member Avatar for vijayan121
0
2K
Member Avatar for OmniX

Oh boy, there is a lot of wind being blown in this topic. To simplify things, everything sent to a function gets copied (or generates an object) if-- -An implicit cast is done (sending an int to a function that takes an Integer object for example (and for further clarity, …

Member Avatar for Alex Edwards
0
151
Member Avatar for hny_lyn

My first question to you is... Do you know what the different between an interface and an abstract class is? O_o

Member Avatar for Ezzaral
0
79
Member Avatar for sciwizeh

Ok one big thing to note, before anything else-- [code=c++] vector<vector<double>> [/code] -- is not a portable statement because >> may (depending on the compiler) be analyzed as the right bitshifting operator and throw an error. You'll want to space out those symbols. [code=c++] vector<vector<double> > [/code] Edit: Also I …

Member Avatar for sciwizeh
0
184
Member Avatar for esy928

Although I haven't attempted it before, I'd assume you'd have a particular zone renderred on the screen with a type of "cover" over it. Either that or only render certain pixels ahead of the borders on a pane. The position of your character would, obviously determine when the screen will …

Member Avatar for esy928
0
303
Member Avatar for acejames1

Although I'm Atheist, I swear to god I got dumber from reading this topic.

Member Avatar for Alex Edwards
0
215
Member Avatar for ceyesuma
Member Avatar for ceyesuma
0
100
Member Avatar for xyzt

I'd assume this is because of the padding factor and vtable pointers like you mentioned before.

Member Avatar for Narue
0
825
Member Avatar for ajithraj

I'm pretty sure it's something along the lines of-- [code=java] Runtime.getRuntime().gc(); [/code] Or the long way-- [code=java] Runtime rt = Runtime.getRuntime(); rt.gc(); [/code] I do believe you can do the same using System instead of Runtime (without calling getRuntime - just System.gc() ) This simply suggests for the Garbage-Collecting threads …

Member Avatar for onkar81
0
108
Member Avatar for ricss_madara

[QUOTE=ricss_madara;671481]class bubbleSort1{ public static void bubbleSort(int[] x) { int n = x.length; for (int pass=1; pass < n; pass++) { // count how many times // This next loop becomes shorter and shorter for (int i=0; i < n-pass; i++) { if (x[i] > x[i+1]) { // exchange elements int …

Member Avatar for mayur_kulkarni
0
93
Member Avatar for chry_15

You probably meant to post your question [URL="http://www.daniweb.com/forums/forum117.html"]here[/URL]

Member Avatar for ~s.o.s~
0
97
Member Avatar for samuel_pay

Don't forget what classes are for! Classes are things capable of having behavior and encapsulating information. Encapsulated information can be data, but it's slightly beyond just that. Behavior can be considered a method, but it's slightly beyond that as well. If you're not worried about the stats of a unit …

Member Avatar for samuel_pay
0
166
Member Avatar for BattlingMaxo

I strongly suggest that you re-read and brush up on C++ syntax before attempting this project. You may end up getting it to work as you are now, but it will either take an incredibly long time, have a lot of errors and/or cause you nothing but headaches. Even if …

Member Avatar for sciwizeh
0
91
Member Avatar for toyomansi

The error-- [icode]append(java.lang.String) in javax.swing.JTextArea cannot be applied to (PhoneDirectorySystem)PhoneBook_TextArea.append(list);[/icode] --is a fairly obvious statement. You could return the toString() of an element in the list and add to the JTextArea. It may even be better to have a toString method available for the entire list (if you're making a …

Member Avatar for toyomansi
0
691
Member Avatar for RayvenHawk

[QUOTE=ff4930;671397]Classes are same as structs with the exception of default private and public.[/QUOTE] That's a good C++ definition, but that doesn't hold true for pure C.

Member Avatar for Undertech
0
136
Member Avatar for TheBeast32

I like williamhelmswort's mouse-hook snippet. It always makes random amusement when I use it on somebody elses computer and watch them struggle to move the mouse XD

Member Avatar for TheBeast32
1
341
Member Avatar for Alex Edwards

Hello I'm reading through Scott Meyer's book Effective C++, third Edition. I'm having an issue understanding Page 14, Item 2, paragraph 4. The below is a snippet of code with an explanation quoted from his book-- [code=c++] // Author: Scott Meyers class GamePlayer{ private: static const int NumTurns = 5; …

Member Avatar for vijayan121
0
1K
Member Avatar for Alex Edwards

I'm enjoying the book Effective C++. It has highlighted things that I've looked over, never heard of, or never even though of before! However, even with this book my understanding of C++ still doesn't seem to be solid. For some time now I've been curious about how binary data is …

Member Avatar for Alex Edwards
0
162
Member Avatar for Risame

[QUOTE=Risame;671865]Well guess I will have to do that, can't see any other way. I have spent like two days trying to make this work, and I guess I have had enough ^^ Thank you all for your help, hope my bad English hasn't been a problem ;)[/QUOTE] Off topic: You …

Member Avatar for Radical Edward
0
253
Member Avatar for nasnoma

Show us what you've come up with on your own. We help you, we don't code for you @_@

Member Avatar for Ancient Dragon
0
111
Member Avatar for ocreds

I'm assuming you're not allowed to use the Math library or recursion. If that's the case, use-- [code=java] static double power(double value, short exponent){ if(exponent >= 0){ // if exponent is greater than or equal to zero... double result = 1; // set result to one for(short i = 0; …

Member Avatar for Alex Edwards
0
125
Member Avatar for lsquared

To make this easier, you might want to consider using a Server class that encapsulates a ServerSocket and has an array of Sockets. The ServerSocket will be used to establish the Server, while the array of Sockets will be used for awaiting Clients (via ServerSocket.accept() ). Attached is a poorly …

Member Avatar for Alex Edwards
0
90
Member Avatar for qaz1134

I made a correction but the code is slightly different. There were some errors in your code, such as assigning a String to the String[] reference and not an actual indice of the String array. Here's the code-- [code=java] import java.io.*; public class name{ public static void main(String args[]) throws …

Member Avatar for vigneswara
0
117
Member Avatar for Alex Edwards

I [I]still[/I] haven't figured out how to give someone neutral rep, yet I see everyone do it @_@ How is this done? I've tried clicking on the radio buttons multiple times in the add-rep form but no luck. Damn you geniuses at Daniweb programming! XP -Alex

Member Avatar for R0bb0b
0
99
Member Avatar for HLA91

You may also want to consider using a BorderLayout so that your Menu bar will appear at the top within a JFrame-- [code=java] import javax.swing.*; import java.io.*; import java.awt.*; import java.awt.event.*; public class JotPad extends JFrame { private JTextArea textArea; public JotPad() { super("Jot Pad"); setLayout(new BorderLayout()); //Arrange the Editing …

Member Avatar for HLA91
0
3K
Member Avatar for Alex Edwards

I've read up to the point where the author explains partial classes. I understand the general concept - they're used when a class is so big that it is better to split it across files. I created two .cs files. Let's say one is CS1.cs and the other is CS2.cs …

Member Avatar for Alex Edwards
0
171
Member Avatar for hny_lyn

I think you're making this assignment harder than it really is. Try to understand the problem first. You are accepting input into a method. The input can be any number except 0 alone. You WILL have data types to store information. At minimum, you will need a data type to …

Member Avatar for MoZo1
0
1K
Member Avatar for Alex Edwards

Hi, my name is Alex. I'm fairly new to C# but apparently I may be required to know how to manipulate .NET Frameworks via C# so I am studying a beginners book and another book to thoroughly understand the language. The problem is that I am struggling to understand the …

Member Avatar for Alex Edwards
0
157
Member Avatar for neknek

I believe your main problem is that you are trying to parse a String without numbers. When I compiled your code I got a number format exception. Here is what I did to eliminate the problem (to an extent) -- [code=java] import java.applet.*; import java.awt.*; import java.awt.event.*; import java.util.*; import …

Member Avatar for neknek
0
96
Member Avatar for mdew_47

[QUOTE=sciwizeh;660605]uh, if it is already an .exe, i think you can look at [URL="http://www.dreamincode.net/forums/showtopic21813.htm"]this[/URL][/QUOTE] I'm really not sure if the link you provided will be helpful, because in Java you cannot make native calls to C++ code directly (or any program that has potential access to memory) within an Applet …

Member Avatar for mdew_47
0
204
Member Avatar for teh noobshow

Ok, you're confusing the phrase "do what I mean" with Java syntax. I strongly recommend for you to read the first link presented here on this forum and get some pointers on how to code syntactically correct Java-style. Also it would help if you posted your code in Code-tags-- [url]http://www.daniweb.com/forums/misc.php?do=explaincode&TB_iframe=true&height=400&width=680[/url]

Member Avatar for Ezzaral
0
146
Member Avatar for Naween

Use code tags please, otherwise if people try to copy/paste your code they will most likely get # symbols that they'll have to manually delete. Not to mention that there's no telling if the code will be indented properly (which means more work for people testing your code). [url]http://www.daniweb.com/forums/misc.php?do=explaincode&TB_iframe=true&height=400&width=680[/url]

Member Avatar for Ezzaral
-1
86
Member Avatar for maddogsprofiles

[QUOTE=maddogsprofiles;668107]I've been on Scriptlance for the past few days, trying to get a programmer for my plurk clone and I have noticed that a lot of the programmers bidding are from India, I thought a lot of my replies would be from the US, but my question is though, can …

Member Avatar for sarehu
0
120
Member Avatar for Alex Edwards

I'm having some trouble on deciding to purchase Scott Meyer's Effective/More Effective C++ books or Herb Sutter's Exceptional/More Exceptional C++. I'm assuming both cover the same concepts, but I could be wrong. Opinions/Votes please from C++ programmers that found the one they read useful. There's also an option for both …

Member Avatar for Alex Edwards
0
270
Member Avatar for shaynicb25

Yes, including a throws on the end of main is considered bad programming practice since nothing can really catch an error generated from main and handle it afterward. Only use throws on the end of main to save time when practicing something particular without bloating the code in try-catch blocks. …

Member Avatar for javaAddict
0
444
Member Avatar for Alex Edwards

Is the [X] at the top right corner part of the JApplet or container with the JApplet? I need to make an action happen when the user attempts to close out of the JApplet and I'm not sure of how to properly access the window-closed button within JApplet context. Thanks …

Member Avatar for Alex Edwards
0
173
Member Avatar for Alex Edwards

I'm having a Focus issue when running a Swing application. There are 4 buttons visible on the JApplet. I have an implementation that allows the user to make keyboard and mouse events in the JApplet. The problem is that I can use the keyboard and mouse events when the program …

Member Avatar for Alex Edwards
0
167
Member Avatar for SonxQ7

[QUOTE=SonxQ7;665790]Is there a Template Class in Java as in C++, or is Object class in Java similar to Template class in C++ or at least the concepts...[/QUOTE] Study Generics/Erasure in Java. It's similar to C++ Templates, but has a major compile-time difference. In Java instances of Erasure types, as the …

Member Avatar for Alex Edwards
0
95
Member Avatar for lich

Use the DecimalFormat API [url]http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html[/url]

Member Avatar for VernonDozier
0
166
Member Avatar for JaksLax

[QUOTE=JaksLax;665393][B]I cant figure out why it doesnt recognize first and last. Any ideas?[/B][/QUOTE] Uh... first and last are local parameters to the constructor in the Person class. They are not at all visible to the derived class Employee. If you want this to work you'll have to change Employee's constructor …

Member Avatar for cikara21
0
112
Member Avatar for NekoGráfico

Do you simply want a separate pointer for the data? If so then this might work-- [code=c++] #include <iostream> #include <vector> using namespace std; typedef struct { void *map; } XE_MAP; typedef struct MAP_LAYER { MAP_LAYER() { map = (XE_MAP*)malloc(sizeof(XE_MAP)); map->map = (void*)data; cout << "Data is at " << …

Member Avatar for NekoGráfico
0
107
Member Avatar for Psykocyber

To invoke function of a class through pointers, you may have to use a pointer to a member function. Your vector will have to store MtFP's instead of regular FP's.

Member Avatar for Psykocyber
0
5K

The End.