6 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Doogledude123

I know you can create nested classed (or just classes declared outside of the class in the same file) but what is the point of doing this? Why not just create a new class file?

Member Avatar for JamesCherrill
0
197
Member Avatar for rahul.ch

<? super Animal> means animal or it's superclass only. Then why inside the method it's allowing to add Dog object even though it's a subclass of Animal? This program compiles and runs! import java.util.*; class Cat {} class Animal{Animal() {System.out.println("Animal constructor");}} class Dog extends Animal{Dog() {System.out.println("Dog constructor");}} public class GenericDemo5 …

Member Avatar for rahul.ch
0
335
Member Avatar for rahul.ch

General rules is that: 1) A private method cannot be overridden. 2) Subclass method should be a lower access modifier than a overridden superclass method. But the output of the program is "I am Son". Why? Is it because of the rule 2 the output comes? If that's the case …

Member Avatar for JamesCherrill
0
202
Member Avatar for Tortura

Hey, following Problem: I have two classes Measurement and its subclass DC_Measurement. Measurement has a method called: [CODE]public virtual SetPoint[,] createSetPointArray()[/CODE] DC_Measurement: [CODE]public override DCSetPoint[,] createSetPointArray()[/CODE] DCSetPoint is also a subclass of SetPoint. I read that this is possible. Now I use in my mainWindow following code which contains an …

Member Avatar for Tortura
0
154
Member Avatar for Tsunami49

Hi there. I am currently trying to get my head around using classes across two files. I currently have a super class and a sub class stored in a file and the main function in another. When I try and pass arguments to the class they work fine if the …

Member Avatar for Tsunami49
0
135
Member Avatar for jonyb222

Good evening Daniweb, I have another idiotic problem which comes from making an arrival subclass out of Event. I have a few other subclasses of Event and they aren't giving me any trouble. I have tried to copy/paste/rewrite to eliminate any stupid typos. Arrival.h:7: error: expected class-name before ‘{’ token …

Member Avatar for jonyb222
0
550

The End.