-
Help with Headers
Hi there.
I want to know how to create and link new header files to my main cpp file, for example:
i make a class.h file, and in that .h file i have a class for example, and i want to like that .h file to my cpp file so i can use that class in the cpp file.
is that possible?? if yes how can i do it??
tks
-
heres an example
car.h
Code:
class car
{
char color;
public:
car();
void honk();
char get_color();
};
car.cpp
Code:
#include "car.h"
#include <iostream>
car::car()
{
color = 'b';
}
void car::honk()
{
cout << "bipbip";
}
char car::get_color()
{
return color;
}
int main()
{
car honda;
car.honk();
}
Is this what you wanted to know?
-
Yes it was, tks for ur help..
solved :)