 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Victor Bazarov Guest
|
Posted: Mon Apr 25, 2005 3:58 pm Post subject: Re: Virtual on block code |
|
|
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
|
Posted: Mon Apr 25, 2005 4:19 pm Post subject: Virtual on block code |
|
|
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 |
|
 |
|
|
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
|
|