135 Topics

Member Avatar for
Member Avatar for kiLLer.zoh_1

<?php class contacts { public $name; public $cno; public $clocation; public function __construct($name,$cno,$clocation) { $this->name = trim($name); $this->cno = trim($cno); $this->clocation= trim($clocation); } public function getName() { return $this->name; } public function getNO() { return $this->cno; } public function getLocation() { return $this->clocation; } } class DataBaseAction extends contacts { …

Member Avatar for diafol
0
170
Member Avatar for asif49

Hi. I have some css that needs to go into a large amount of websites. It generally contains very simple like all new elements with very unique names that will not be matched by anything these websites currently contain. The problem I am having is that some of these sites …

Member Avatar for almostbob
0
203
Member Avatar for AppleR

So basically im creating this python adventure text game. And so far its good. But i have this problem with class instances(Is that the right term?) Say for example i have this class, class monster(object): def __init__(self,health,attack): self.damage = damage self.health = health So then I create a class object(again, …

Member Avatar for AppleR
0
340
Member Avatar for Violet_82

Hi chaps, I am looking for a not too difficult exercise which involves superclasses and subclasses (the java book I am reading doesn't really have any good one). So I was thinking about something like this: Create a superclass 2DimensionalShapes and 2 subclasses Rectangles and Triangles. I will then need …

Member Avatar for Violet_82
1
230
Member Avatar for mward92

I have made 4 classes that represent an Employee based Java GUI. They are Person, Employee (extends the Person class), EmployeeFrame (used to model a JFrame), and EmployeeTester (contains the main method to run the GUI). What I want the GUI to be able to do, is allow the user …

0
139
Member Avatar for MRehanQadri
Member Avatar for bobit

I do not know if I am on the right track or not, but I have hit a dead end. I have read and reread my books chapters about super classes and inheritance and am still completely lost. in this assignment I have to: **Write a super class encapsulating a …

Member Avatar for stultuske
0
569
Member Avatar for bobit

I have to: **write a class encapsulating a sports game, which inherits from Game. Where the game has the following additional attributes: whether the game is a team or individual game, and whether the game can end in a tie. ** I am not familiar with inheritance and am wondering …

Member Avatar for JamesCherrill
0
2K
Member Avatar for xHellghostx

I am having a problem to understand how class inhertance works in Java.. Now I want to get information from a class to another and let's say we have class A and class B class A contains a string an int and a byte class B contains a String and …

Member Avatar for stultuske
0
281
Member Avatar for Begginnerdev

Upon aiding a friend - I have decided to post the example used here. The following is a snippet that shows basic class inheritance. The source file as well as a test case can be found attached. You can test these classes with the following code: Dim cNew As New …

3
215
Member Avatar for asteriskLMNOP

Please bear with me, this is my first post So, I have this superclass called A. And I've 2 subclasses A1 and A2. A has attribute name. A has function toString(). A1 inherits name, and has attribute hair. A1 has a method toString() which goes: string A1::toString(){ string stringA= A::toString(); …

Member Avatar for ravenous
0
1K
Member Avatar for sciwizeh

Hello all, I have not tested the code I'm posting here to see if it compiles, but I have an issue in a large codebase and I believe that this should be the simplest program to demonstrate the issue; class base { public: shared_ptr<base> clone()=0; }; typedef shared_ptr<base> baseptr; class …

Member Avatar for sciwizeh
0
20K
Member Avatar for szejna

Hello, I am working on a homework problem that has to do with inheritance, I thought that as long as the class interface and implementation files for the base classes the derived would work with the include statement: #include "salariedemployee.h" and the line class administrator : public salaried employee. I …

Member Avatar for szejna
0
254
Member Avatar for rami sohaill

package hospitalclient; public class Person { static int idnumber= 1500; private String name; private String telephoneno; private char gender; private String nationality; //No Parameter constructor public Person() { name="unassigned"; telephoneno = ""; gender = 'M'; nationality = "Saudi"; } public int getid() { return idnumber; } // Accessor Methods public …

Member Avatar for JamesCherrill
0
349
Member Avatar for ogrishmania

I'm sort of a begginer in classes. I must implement a simple problem: chosing a phone. I thought that I should make a program in which a user can select some conditions, like must have wifi or not, android or other, etc. and return a list with the phones that …

Member Avatar for mrnutty
0
284
Member Avatar for challarao

Hi all, A problem asks me to create a point class,line class composing two points, a triangle class composing three lines.Also a right angle triangle and an equilateral triangle class both inherit triangle class.I did this. public class Point{ private int x; private int y; public Point(int x,int y){ //error …

Member Avatar for jalpesh_007
0
192
Member Avatar for MugANDGlass

can anyone help me? i got problem count the monthly installment. //class class vehicle { public: char model[20], color[20], brand[20]; float price, deposit, rate, monthly_installment, newprice; int term; public: void calculate_installment(); }; class car:public vehicle { private: float installment, newprice; public: void calculate_installment(); }; //main program #include <iostream> #include <string.h> …

Member Avatar for DeanMSands3
0
167
Member Avatar for jongiambi

Hi so I have a practice lab I am working on where I am asked to fill in the code. The program is supposed to take in two 3D points (x,y,z) and compute the distance between them. I have almosty all of the program finished im just stuck on how …

Member Avatar for rubberman
0
841
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

class Sample1 { Sample1() {System.out.println("Sample1 const"); } void doStuff(){System.out.println("sample1 dostuff"); } } class Sample2 extends Sample1 { Sample2() {System.out.println("Sample2 const"); } } public class Sample3 extends Sample2 { Sample3() {System.out.println("Sample3 const"); } public static void main(String r[]) { new Sample3().go(); } void go() { super.doStuff(); } } The output is: …

Member Avatar for rahul.ch
0
195
Member Avatar for rahul.ch

import java.io.*; public class Mac extends Laptop { public static void main(String r[]) { new Mac().crunch(); } //insert code here } class Laptop { void crunch() throws IOException { } } The question is simple. Insert a code that will make the program compile. Answers are: `void crunch()` or `void …

Member Avatar for NormR1
0
212
Member Avatar for rahul.ch

int [] ia1 = {1,2,3}; int [][] ia2; Object o = ia1; ia2 = new int [3][3]; ia2[0] = (int[])o; ia2[0][0] = (int[])o; Answer is "Compilation fails in last line" Explanation: Arrays are objects, and that each array dimension is a separate type. So, for instance, ia2 is of type …

Member Avatar for stultuske
0
211
Member Avatar for rahul.ch

import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC …

Member Avatar for rahul.ch
0
225
Member Avatar for sblass92

Lets say I have a class A and I also have classes B and C that inherit from class A class A { virtual void foo()=0; //stuff } class B : class A { void foo(); //more specific stuff } class C : class A { void foo(); //more specific …

Member Avatar for sblass92
0
343
Member Avatar for Pyler

I wanted to write a simple program that uses classes but I've been running into errors. Anyone have a clue as to what is wrong with my code because I can't seem to figure it out. #include <iostream> #include <iomanip> #include <cmath> using namespace std; class cone{ private: double radius; …

Member Avatar for Rashakil Fol
0
248
Member Avatar for flynismo

As the title suggests, I created a base class named **member** which I want to use to get some basic information, but for some reason, I cannot seem to access those methods/values from the child class named **user_send_message** Here is the complete code that I have made so far -- …

Member Avatar for mschroeder
0
369
Member Avatar for jameswj83

I am having trouble with this assignment, especially the input file and how to get the data into an array: You will design a set of classes for storing student information, along with a main program that will read student information from a file, store the data, compute final grades, …

0
246
Member Avatar for grh1107

currently I'm rewriting old euler solutions into classes so i can store them in a library. I wrote a program that digitizes a number so it can check to see if it a pallindrome, The base class digitize dynamically allocates memory for the size of a number and stores each …

Member Avatar for mike_2000_17
0
247
Member Avatar for mano7859

Hi, I got a problem with class. I've created 3 classes: * identifiantsClass.php * connectInfosClass.php * sqlClass.php In my third class, i always have the message: "error to connect" even if my database's name is good. Please help me... * identifiantsClass.php class Identifiants{ protected $serveur=null; protected $host=null; protected $mdp=null; protected …

Member Avatar for veedeoo
0
134
Member Avatar for TrustyTony

I would like to take string argument for class BalancedTrinary intializer, but the string type of argument is processed before it enters the init function. I guess I must override any class method which deals with those for int/long? def val(number_sequence, base): """ produce integer value of number_sequence as base …

Member Avatar for Gribouillis
0
274

The End.