design Pattern of Classes

A

andrew.smith.cpp

Victor said:
<shrug> I've never heard the expression. Perhaps you're asking about
the software design patterns, see the book by Erich Gamma et al., or
post to 'comp.software.patterns'.
Thanks Victor
i m asking how to design a class in the "C++ Code"
 
P

Pascal J. Bourguignon

Thanks Victor
i m asking how to design a class in the "C++ Code"

You would design it like in any other OO programming language. Of
course, there may be some more C++ specific idioms, like the RAII
idiom, (http://en.wikipedia.org/wiki/RAII), but there's nothing
really specific to C++.
http://en.wikipedia.org/wiki/Design_pattern_(computer_science)


If the question is how to write a class in C++, then you'll have to
learn the C++ syntax. Basically, you write:

class NameOfClass : public NameOfSuperClass {
public:
NameOfClass();
virtual ~NameOfClass();

virtual ResultType otherMethod(...);
...

protected:

AttributeType attributeName;
...
};

NameOfClass::NameOfClass(){
// code of constructor
}

NameOfClass::~NameOfClass(){
// code of destructor
}

ResultType NameOfClass::eek:therMethod(...){
// code of method
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,939
Members
47,484
Latest member
JackRichard

Latest Threads

Top