473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

header include structure

This must have been the MFC (or basic C++) class I slept through:

I have a typedef in a header file (for a CView subclass). I want to
use this type in another .h file.

How do I make this type available to another header (as a member
variable, for instance)? It (obviously) works to just include the .h
file with the typedef in the desired header, but I know this is bad
style and might cause problems in the future.

Thanks,
marsboee
Jul 19 '05 #1
3 3601
On Thu, 11 Sep 2003 16:37:20 -0700, marsboee wrote:
This must have been the MFC (or basic C++) class I slept through:

I have a typedef in a header file (for a CView subclass). I want to
use this type in another .h file.

How do I make this type available to another header (as a member
variable, for instance)? It (obviously) works to just include the .h
file with the typedef in the desired header, but I know this is bad
style and might cause problems in the future.


No, it's not bad style. It's what you do. Alternatively, you could
duplicate the typedef in the other header, but that /is/ bad style and
might cause problems in the future. :-}

Josh
Jul 19 '05 #2
It is perfectly fine to include the class header file even if
you are just interested in one of the structures.

Checkout the following article about header file inclusion:

http://www.eventhelix.com/RealtimeMa...dePatterns.htm

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Generate Sequence Diagrams and Use Cases in PDF
Jul 19 '05 #3

"marsboee" <aa********@yahoo.com> wrote in message
news:18**************************@posting.google.c om...
This must have been the MFC (or basic C++) class I slept through:

I have a typedef in a header file (for a CView subclass). I want to
use this type in another .h file.

How do I make this type available to another header (as a member
variable, for instance)? It (obviously) works to just include the .h
file with the typedef in the desired header, but I know this is bad
style and might cause problems in the future.


Why is it "bad style"? Unless you are talking about namespaces keeping
things cleaner, but even so those have to go into header files too if you're
going to use them in multiple places.
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Mesara | last post by:
I have the following file structure: / header.asp test.asp /subDir testpage.asp /images I would like to have header.asp to be usable from all directories.
3
by: Chris Mantoulidis | last post by:
Seperate compilation (that's what it's called, right?) seems to be quite popular, so I decided to get some info about it, and (d'oh) use it... But it's whole structure seems weird to me... ...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
3
by: Jared | last post by:
Hi, Can someone explain the basic structure of a header file? I just completed a introductory C programming class. The course stressed structured programming and creating reusable code. We...
18
by: John Smith | last post by:
Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
8
by: nrhayyal | last post by:
Hi c++ Gurus, Need your blessing. while testing few aspects with respect to header file inclusions, i observed few things which i would like to share with you. i have a file sqlca.h in which a...
12
by: Ben | last post by:
I'm kind of new to creating templates. I've made some small class and function templates in the past and I have used quite of bit of the STL, but I am having problems tyring to create templates. ...
0
by: abarun22 | last post by:
Hi I am facing a problem while including a C header file in the SWIG interface file. However the problem does not occur when i directly copy the contents of header file in the same place. My...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.