462 Topics
| |
Hello, I have a class Pdisk [CODE] class Pdisk { public : Pdisk(string diskname, int numberofblocks, int blocksize); private : string diskname; int numberofblocks; int blocksize; }; [/CODE] Now I want to make a class filesys which can access an object of class Pdisk. I am not sure how to … | |
I'm new to deployment of an application in C#, especially im running on a 64 bit OS. When i entered Visual Studio, i configured my application to run in 32bit, what happened was, it created a folder in the debug folder and it's name is "x86". When i checked it … | |
Is it possible to put a gap in a class definition? IE: [CODE]class a; class b { private: a test; public: a getA(){return test;} }; class a { private: int i; public: a(int i):i(i){} a operator+(int o)const{return a(i+o);} }; class b continued?//what? how? { void outputA(){cout<<a;} };[/CODE] This is just … | |
Ok I think im getting better at these but not quite still have these implicit convert from int to string problems and the usual "does not exist in the current context" dilemma. [CODE]/* * */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Calories { class Calories { static … | |
Is there a way to make a class visible only from within another class. i.e: [CODE]class myclass { private: class anotherclass { //stuff that only can be used from within a myclass function void dosomething(); float dosomethingelse(); }*anotherclasses; int numanotherclasses; public: int createanotherclass();//creates anotherclass object, puts it in the array … | |
Howdy, I have a few questions regarding the use of ctime within a class. I followed the example on [URL="http://www.cplusplus.com/reference/clibrary/ctime/strftime/"]http://www.cplusplus.com/reference/clibrary/ctime/strftime/[/URL] When the program is like this, it works: [CODE] #include <ctime> #include <iostream> using namespace std; int main(){ time_t current_seconds; current_seconds = time(NULL); //Fills current_seconds with the number of seconds … | |
Getting some errors at least this time I know why..seems like I am not declaring the methods inside my classes I tried rearranging the method and then inserting all my code into a class but Im still getting all those errors in the bottom. If you guys can tell me … | |
I've managed to use classes in separate files before, but I can't seem to get it to work here. I was just programming some very basic classes for a simple game I wanted to make. Here is the main.cpp file: [code]#include <iostream> #include "energySystem.h" #include "healthSystem.h" #include "intelligenceSystem.h" using namespace … | |
the aim of this program is to create a record of 20 members inputted by the user st the phone number is stored in 3 different parts e.g. 011-234-7891 where 011 is area code 234 is exchange and 7891 is numbr...every record must have a member id and member name … | |
Hi all, I am having trouble with class communication to reset some textfields through event handling. Any help would be appreciated. Here is a portion of my code. [B]The class that contains the textfields that I wish to use a reset button for:[/B] [CODE]import java.awt.*; import javax.swing.*; import javax.swing.border.*; public … | |
I am having an error with my constructor, why is that? :| [CODE]public class Name{ private String firstName; private String middleName; private String lastName; public Name(){ this( "null" , "null" , "null"); } public Name(String first){ this(first," "," "); } public Name(String middle){ this(" ",middle," "); } public Name(String fName … | |
Hey Guys, I'm working on a C++ program for school. Basically the Program inputs a file of points and outputs an svg file that contains the Graph with the least number of edges. We need to implement this with the Kruskal and Prim algorithm, and the algorithm needs to be … | |
Hi, Im trying to convert my UserControls to be sharable across multiple projects. I have read up on this, and it seems that I need to have all code in one file (i.e. in the .ascx, rather than codebehind/designer) so I am trying to do this: [CODE] <%@ Control Language="C#" … | |
I have the following codes: [CODE] <?php class LongName { var $firstname = " "; var $middlename = " "; var $lastname = " "; function firstname() { echo "First Name : ". $this -> firstname; } function middlename() { if (middlename){ echo "Middle Name : ". $this -> middlename; … | |
#include <iostream> #include "Invoice.h" using namespace std; int main() { string description; double price; int quantity; cout << "Enter the description: "; getline(cin, description); cout << "Enter the unit price: "; cin >> price; cout << "Enter the quantity: "; cin >> quantity; cout << endl;//a new line //create an … | |
Ok I am a programming student and need help with a problem, I already have most of it (so I don't need you guys to do my hw :P) but I am having problems with am, and I am not even sure if I am doing it right. [B]Problem:[/B] (The … | |
hey guys so I'm studying a unit called Object Oriented Analysis its not one of my strongest units so i need some help in the concept of understanding UML and i have a exam coming up and i was if you guys could help me understand the basic concepts here … | |
Hi, I need to finish a assignment on operator overloading but this one piece of code doesnt seem to make sense.. in my int main() i have int main() { Element a, b(5), c(7), d; cout << (5+b) << endl; this is just part of it, I have already implemented … | |
please help me i m having problem for making this program First Part: (Using Structures) Create a structure called Complex for performing arithmetic with complex numbers. Complex numbers have the form realPart + imaginaryPart * i where i = √(-1) Use floating point data to represent members of structure (i.e. … | |
I need to make 45 objects of a nested class within my main class. I have tried instantiating the objects inside the main class' data fields and then inside of its default constructor. After being instantiated, i need to add 15 of the objects to 15 more arrays (each object … | |
I am in situation like I have a class which have two different subclasses. [CODE]public class SuperClass{ String st; public String getSt(){ return st; } } class A extends SuperClass{ } class B extends SuperClass{ } [/CODE] Now I have another method that want to access the getSt inherited method … | |
In one of the books I'm using to study Python I keep seeing things like: [CODE] class Application(Frame): super(Application, self).__init__(master): self.grid() self.bttn_clicks=0 self.create_widget"""which is another function in the class"""[/CODE] Why is the super necessary for the class if the class it's calling is itself? | |
Hey all, I've been programming an ISBN system of sorts and I'm a little stuck (again). I want to output my linked list to a text file, so I setup the code like this: [code] void saveList(char fileName[40]) { for ( list< Publication* >::iterator it = pubList.begin(); it != pubList.end(); … | |
Hey all, I'm attempting to use an STL List to store a list of objects. Now I realise it's quite trivial to store a list of objects of my own definition. My real question is, how do I fill the list with objects that inherit from a base class. E.g. … | |
What's wrong with my code? Why can't I output the "hahahaha" string from public constructor1?? help me please. [CODE]using System; namespace hahahahahahahahaha { class Program { public static void Main(string[] args) { constructor1 obj = new constructor1(); } } public class constructor1 { public constructor1(); { Console.WriteLine("hahahaha"); } } }[/CODE] | |
I just watched this tutorial: [url]http://www.youtube.com/watch?v=NTip15BHVZc[/url] and tried it myself, but I could not get it to work, I get these errors: [CODE]||=== 15. Placing classes in separate files, Debug ===| C:\Program Files (x86)\CodeBlocks\programs\tutorials\15. Placing classes in separate files\src\testClassFile.cpp|1|error: testClassFile.h: No such file or directory| C:\Program Files (x86)\CodeBlocks\programs\tutorials\15. Placing classes … | |
Hi Guys, I was going through a [URL="http://www.daniweb.com/software-development/java/threads/374765"]thread[/URL] in this forum and there is one very good reply to this thread. In the past Ive never used such techniques to idetntify how many classes would I create in my program, thus my programs used to be complex. Can you suggest … | |
The below code is showing error i checked lots of time didn't find any error please help me. [CODE] class emp{ int id,sal; String name; emp(int id,int sal,String name) { this.id=id; this.sal=sal; this.name=name; } void show() { System.out.println("Name: "+name); System.out.println("Salary: "+sal); System.out.println("ID: "+id); } } class manager extends emp{ int … | |
Hi, I was wondering whether it is possible to use a parent class' properties without calling its constructor. In the following example: [CODE]<?php class Shop { public $location; public function __construct($location = ''){ if(!empty($location)){ $this->location = $location; } else { $this->location = 'a place far far away'; } $this->location .= … | |
Hi everyone! I am trying for the first time to write "proper" object oriented c++ (ANSI) code. Up until now everything was made easy to me using visual studio and working with mfc or .net which both handle a lot of the "dirty" stuff... To the point : I want … |
The End.