jeudi 8 janvier 2015

How can I check if a vector with a custom class is NULL?

I have made this custom class



#ifndef VEHICLE_H_
#define VEHICLE_H_

Class Vehicle {
public:
Vehicle();
Vehicle(char,char,int,int);
virtual ~Vehicle();
char getLicense_plate();
void setLicense_plate(char);
char getBrand();
void setBrand(char);
int getTime_in();
void setTime_in(int);
int getTime_out();
void setTime_out(int);

char license_plate;
char brand;
int timei;
int timeo;
};


And I have created a Vehicle vector with size 50 in the main.cpp but I don't how to check each value if they are empty.



#inlcude<iostream>
#include<vector>
#include<algorithm>
#inlude "Vehicle.h"
using namespace std;

int main()
{
vector<Vehicle> avai_space(50);
for(int i=0;i<avai_space.size();i++)
{
//if(avai_space(i) == NULL??){}

Aucun commentaire:

Enregistrer un commentaire