sorry about my ignorance, but exactly how do you declare a function a friend function
Thanks very much!!
Michael
User Profile
Collapse
-
problems overloading << operator
Hello!
I'm trying to overload the << operator but it just won't work
my code is the following:
Code:the student.h file #include <string> #include <iostream> using namespace std; class student { private: string name; string department; public: student(string n = "", string
-
-
-
I would like to create a directory an later on create several files inside that directory.
example:
--ExampleDir
----ExampleFile1
----ExampleFile2
----ExampleFile3
----ExampleFile4...Leave a comment:
-
directory handling in c++
Helo everybody!
I'm trying to use directory manipulation in c++ I'm using Borland c++ builder x compiler or a minimalist gnu c++ compiler and I can't find a way to be able to create and manipulate directories. I read a litlebit in the internet and found something about a library called dir.h but I can't find this library in my compiler.
Any help will be gratly apreciated!!
Greetings Michael -
I'm using Borland Win 32 compiler tools
probably the problem is, that mycompiler doesn't suport automatic template instanciation. Something that I find verry anoing. What point does it have to use templates if you cant use them for a type without instancieting them first.
Thank you for your help!
regards
MichaelLeave a comment:
-
this is verry nice and I already knew about it, but there has to be a way where you dont have to use this
[HTML]
template class Template<int>;// explicit instantiation of int version
[/HTML]
What I want to do is write a Class for example a Stack class that I can use with whatever type of data without having to explicitly instantiate.Leave a comment:
-
How to use templates propperly
Helo I´m having trouble finding out how to use templates properly. Te problem I´m having is, that I can´t find the right way to make the templates work outside the file where the class using the template is declared. Look at the following example.
Template.h file
[PHP]
#ifndef TEMPLATE_H
#define TEMPLATE_H
template<typena me T>
class Template{
private:
T info;... -
Problems with FileImageOutputStream
Hi I'm trying to write to a text file with the class FileImageOutput Stream but I can't manage to overwrite the file I'm writing to. So I tried to flush the Object with the flush() method but it still doesn't work. Here is my code:
Code:import java.io.File; import javax.imageio.stream.FileImageInputStream; import javax.imageio.stream.FileImageOutputStream; import java.io.FileNotFoundException; import java.io.IOException;
-
-
problems with strtok()
Hi everybody!
I'm having trouble using strtok to fill a matrix with int nrs. from a file.
the code that is not working is the following:
Code:#include <iostream> #include <fstream> #include <string> #include <stdlib.h> using namespace std; void leerMatriz(char * archivo,int matriz[11][11]); void leerMatriz(char * archivo,int matriz[11][11]){
-
Thank you very much!
One more question. Is there some kind of refference where all thees tricks with files are explained?Leave a comment:
-
problems with seekg
Hi I'm trying to read a textfile and print it's content twice to the std::cout but it won't work the second time. I think it has something to do with the seekg(0) command but I don't know.
here is my code:
the seekg.cpp file:
Code:#include <iostream> #include <fstream> using namespace std; int main(){ ifstream in("data.txt",ios::in); if(!in){ cerr<<"file
-
-
I get the idea now, a virtual method in c++ is not the same as an abstract method in java. But isn't there a way to declare a class abstract, that is that there can be no instances of this class?Leave a comment:
-
problems with inheritance in g++ compiler
I'm trying to compile the following code but it won't work.
the compiler always tells me:
michael@michael :~/forum$ g++ *.cpp
ClassB.cpp: In member function `virtual void ClassB::abstrac tMethod(int) const
':
ClassB.cpp:6: error: passing `const ClassB' as `this' argument of `void
ClassA::setAttr ibute(int)' discards qualifiers
michael@michael :~/forum$
I've tried to... -
Basically Constructors are there to instantiate an object of a defined class. in your example the class is Cat. What this mean is, when your program calls Cat Frisky(5); in the main method, a new instance of Cat is created. How this is done is pretty simple , remember the
Cat::Cat(int initialAge) part of your cpp file? This is the code that is executed when you tell the program to do Cat Frisky(5). Frisky is the name of the variable that...Leave a comment:
-
g++ compiling
I can't compile this using g++
michael@michael :~/g++$ g++ program.cpp
//ClassA.h
class ClassA{
private:
int atribute;
public:
ClassA(int atribute);
};
//ClassA.cpp
#include "ClassA.h"
ClassA::ClassA( int atribute){
this->atribute = atribute;
}
//program.cpp
#include "ClassA.h"
#include <iostream>...
No activity results to display
Show More
Leave a comment: