• Advertisement
Sign in to follow this  

Types of classes in C++

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Actually I knew about only abstract and normal class in which we have some or all members. But I think there are other also like concrete etc... Can anyone tell me how many types of classes we have? What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?

Share this post


Link to post
Share on other sites
Advertisement
The term "concrete class" means [Booch] that a template class has been got actual parameters and hence could be instantiated as an object.

Template class --instantiation--> concrete class --instantiation--> object

I'm using the term "effective class" for classes that implement the full functionality of an abstract base class.

But I'm not sure whether that are common definitions of that terms.

Quote:
Original post by TEUTON
What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?

A C structure if we're speaking about C++ ;) Ah, but non virtual public member functions are allowed ...

Share this post


Link to post
Share on other sites
I don't think that I know all kinds...

The "template" or "parametrizable" or "generic" class is one that has a defined behaviour and a defined interface but just not totally specified parameters.

A "concrete" class, as already said, is a template where also the template parameters are given.

An "abstract" class has pure virtual functions.

An "effective" class has no pure virtual functions (often used with the mean of a class derived from an abstract class).

A "derived" class is inheriting another class.

A "base" class does not inherit another class.

A "meta" class is a class that describes an object class, e.g. what is its name, super class, methods, fields, and so on, and that collects functionality and fields identical for all object instances of that class. C++ supports this partly by RTTI and static class members.

(EDIT) An "inner" or "nested" (or AFAIK "embedded") class is one declared in the scope of another class.

(EDIT) An "anonymous" or "unnamed" class has no predefined name. C++ doesn't support this kind of classes, but e.g. in Java you could have them in combination w/ "nested". However, one could reach a similar thing in C++ by embedding a named class into an anonymous namespace.

Some but not all of the above could be combined, of course.

Whether a class without private/protected members is named a public class or what it out of my knowledge. Other kinds than the ones above are currently not in my mind. What doesn't mean that there are no more ...

[Edited by - haegarr on April 8, 2006 2:49:57 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by TEUTON
What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?


Well, there are a few additional restrictions, but that sounds mightily like a Plain Old Data (POD) type.

Share this post


Link to post
Share on other sites
Quote:
Original post by TEUTON
What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?


A namespace.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Bregma
Quote:
Original post by TEUTON
What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?


A namespace.


You can't make instances of namespaces.

Share this post


Link to post
Share on other sites
Quote:
Original post by Fruny
Quote:
Original post by TEUTON
What do you call a class with NO explicitly defined constructors, private or protected members, base classes, or virtual functions?


Well, there are a few additional restrictions, but that sounds mightily like a Plain Old Data (POD) type.


IIRC (I may be wrong. I'm often wrong when it comes to the Holy One) one of these few additional restrictions is that your class members should also be POD types.

Don't hit me if I'm wrong.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement