C and C++ both use .h extension for headers.
By default this file opened in c-mode.
Check headers for C++ keywords to enable c++-mode.
--- a/.emacs-my Tue Oct 12 15:05:33 2010 +0300
+++ b/.emacs-my Thu Oct 21 16:05:39 2010 +0300
@@ -980,6 +980,18 @@
(add-to-list 'auto-mode-alist '("\\.js$" . js-mode))
+(defun my-c++-header-file-p ()
+ "Return non-nil, if in a C++ header."
+ (and (string-match "\\.h$"
+ (or (buffer-file-name)
+ (buffer-name)))
+ (save-excursion
+ (re-search-forward "\\_<class\\_>" nil t))))
+
+(add-to-list 'magic-mode-alist
+ '(my-c++-header-file-p . c++-mode))
+
+
(setq-default comment-style (quote indent))
(setq-default comment-column 44)
(setq-default comment-fill-column my-fill-column)