0

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.

3
Contributors
3
Replies
20
Views
4 Years
Discussion Span
Last Post by subash sonar
0

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.

Edited by Moschops

0

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
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.