-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: _SmilingVishal
Message 5 in Discussion

Hi, Abstraction is selective ignorance.An abstract type provides a group of related 
functions whose joint actions completely define the abstraction as far as its uses are 
concerned. The irrelevant details of how the abstraction is supported are completely 
hidden. If you are a C programmer, think of a class as an extension of the struct 
type. A struct contains predefined data types, for example, char or int, and might 
also contain other struct types. C++ allows a struct type to have not only data types 
to store data, but also operations to manipulate the data. The C++ keyword class is 
analogous to struct in C.   
C++ provides classes as a means for data abstraction. You decide what types (classes) 
you want for your program data and then decide what operations each type needs. In 
other words, a C++ class is a user-defined data type. 
For example, if you define a class BigNum, which implements arithmetic for very large 
integers, you can define the + operator so that it has a meaning when used with 
objects in the class BigNum. e.g if n1 and n2 are objects of the type BigNum, then the 
expression n1 + n2  has a value determined by your definition of + for BigNum.  
 An abstract data type is an existential type. 
The important thing about an abstract type is that there exists a data type that 
solves some requirement equations.If, in addition, the set of the data type 
solutions obeys some (syntactic) structural rules, then parametric poly-morphism 
may be used to provide a uniform implementation. 
For Example: 
template<class T, class Container = deque<T> >
class stack {
protected:Container c;
public:
bool empty() const { return c.empty(); } 

value_type& top(){ return c.back(); } 

const value_type& top() const{ return c.back(); } 

void push(const value_type& x){ c.push_back(x); } 

void pop(){ c.pop_back(); }
}; 
Regards, 
_SmilingVishal

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to