C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Virtual on block code

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Victor Bazarov
Guest





PostPosted: Mon Apr 25, 2005 3:58 pm    Post subject: Re: Virtual on block code Reply with quote



Samee Zahur wrote:
Quote:
I'd like everone's opinion on this:
Every now and then we write up classes with *nothing* but abstract
functions - interfaces, as they are called. When writing up about a
dozen function prototypes, the need to prefix 'virtual' and suffix '=0'
can often get annoying for the coder as well as for the reader. So
can't we have a shortcut syntax like:

virtual
{ void fun1(int,int);
int blah(float);
}=0;

What does everyone else here think?

I think it makes the class definition harder to read than

virtual void fun1(int,int) = 0;
virtual int blah(float) = 0;

However, I can see defining a whole class as 'interface' by use of
'virtual' in the class definition:

class virtual ABC {
public:
void fun1(int,int);
int blah(float);
};

which should mean that all functions are virtual and pure (including
the compiler-provided destructor and the assignment op). The d-tor
should be trivial in that case IIUIC and its purity is superficial.

Not sure it can be done or whether it already has been suggested.

V

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Samee Zahur
Guest





PostPosted: Mon Apr 25, 2005 4:19 pm    Post subject: Virtual on block code Reply with quote



I'd like everone's opinion on this:
Every now and then we write up classes with *nothing* but abstract
functions - interfaces, as they are called. When writing up about a
dozen function prototypes, the need to prefix 'virtual' and suffix '=0'
can often get annoying for the coder as well as for the reader. So
can't we have a shortcut syntax like:

virtual
{ void fun1(int,int);
int blah(float);
}=0;

What does everyone else here think?

Samee

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.