I am a student and C + + are not going me so well, so I'd ask the experts for some help. I'm using Visual Studio.
I made this topic that I sometimes ask you for help. Please,may someone help me with this code...??? thank you
template<class T1, class T2, int max>
class Kolekcija{
T1 * _member1[max];
T2 * _member2[max];
int * _currentlyMember;
public:
//1. construktor/destruktor
//2. AddElement
//3. RemoveElement
//4. operator-=
};
class Date{
public:
int _day, _month, _year;
Date(int d,int m,int g){
_day = d; _month= m; _year = y;
}
};
class PassedItem{
string _name;
Date _dateOfPassed;
public:
//1. construktor and destruktor function
//2. Info
};
class Student{
const int _numberOfIndex;
char * _FirstName;
Kolekcija<PassedItem *, int, 50> _passedItem;
public:
//1. construktor/destruktor
//2. AddPassedItem;
//3. RemovePassedItem
//4. operator <<
};
class Test{
string _NameOfTest;
string _NameOfItem;
vector<Student *> _registeredStudents;
public:
//1. construktor/destruktor
//2. AddStudent
//3. RemoveStudent
//4. Info
};
void main(){
}
for a constructor you want to do something like this: className(/*variables for the class or can be blank*/);
deconstructer: ~className();
functions: dataType functionName (/*variables for function*/);
Hope that helps a little bit...
dataType would be void, struct, int, etc...
className could be anything and functionName could be anything
variables, just put whatever variables you want in your function, then when you create the function in the cpp file then you don't need to actually declare those variables inside the function, it's done in the parameters.
I gave the explanation in the comments. I hope you now understand what I am looking for ...
Yes, I need constructors with variables and blank, both... tnx
#include <iostream>
#include <vector>
using namespace std;
template<class T1, class T2, int max>
class Collection{
T1 * _member1[max];
T2 * _member2[max];
int * _currentlyMember;
public:
//default constructor
Collection(){}
/*RemoveElement:: removes the element at the required location. When removing the element make necessary deallocation and prevent the occurrence of elements of the array.*/
void RemoveElement(int location){}
//operator-= ::from existing collections (Member 1 and 2) removes the elements
//that are identical to one of the elements in the collection, which was received as a parameter
};
class Date{
public:
int _day, _month, _year;
Date(int d,int m,int y){
_day = d; _month= m; _year = y;
}//Info function that returns the string in the format DD / MM / YYYY
};
class PassedItem{
string _name;
Date _dateOfPassed;
public:
//Required constructor and Destructor functions
//Info function that returns the string value of an attribute class
};
class Student{
const int _numberOfIndex;
char * _FirstName;
Kolekcija<PassedItem *, int, 50> _passedItem;
public:
//constructors/destructor
//AddPassedItem::allows you to add new items passed. Prevent the addition of two corresponding objects
//RemovePassedItem::based on the name, remove the item from the list of installed items
//operator <<::prints all available data on student
};
class Test{
string _NameOfTest;
string _NameOfItem;
vector <Student *> _registeredStudents;
public:
//constructors/destruktor
//AddStudent::allows students to add to the list of applicants for the exam. Disabled
//add two identical student
//RemoveStudent::removes the student from the list of registered
//Info::removes the student from the list of registered
};
void main(){
//check the validity of the execution of all the available functionality
//shortly explain and demonstrate the concept of polymorphism
}