Hello,
I m new to the programming language and i m using turbo c++. If any one kindly give me a link for the meaning and definition and the uses of the different type of header file used in the c++ and there different types of function.

Recommended Answers

All 3 Replies

There is only one kind of header file in C++. It's a plain text file and it gets put into your code wherever you #include it. It's up to you what you put in it, but I suggest you put in it things you would have to write many times otherwise; things like function declarations.

It is also usual to put in guards to avoid including the file multiple times in order to avoid certain classes of compiler errors. Here is an example, call it myheader.h:

// myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H

// Put header stuff here
class MyClass
{
private:
    int m_intmember;
public:
    MyClass() : m_intmember(0) {}
    ~MyClass() {}
    int getIntMember() const { return m_intmember; }
    void setIntMember(int nv) { m_intmember = nv; }
};

#endif // MYHEADER_H

Thanks, but can u give me it again with explanation. I will be extremly thankful to you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.