overload string class

A

asit

I need to implement some string functions in my string class. is it
possible to overload string class ???
 
J

Jorgen Grahn

I need to implement some string functions in my string class. is it
possible to overload string class ???

"Overload" is something you do to function names, not classes.
Do you mean "is it possible to inherit from std::string?"

It is often better to implement such functions as normal functions
which operate on std::string arguments:

void my_function(std::string& s);

/Jorgen
 
Ö

Öö Tiib

I need to implement some string functions in my string class. is it
possible to overload string class ???

You can not have member functions with same name with class, class
name is reserved for constructors. Do you have a dictionary? Search
some other word with same or close meaning from it like 'text'.
 
A

asit

You can not have member functions with same name with class, class
name is reserved for constructors. Do you have a dictionary? Search
some other word with same or close meaning from it like 'text'.

i need to inherit from string class. My requirement is like that
making functions which acts on string class with make the design
brittle.please suggest me.
 
R

red floyd

i need to inherit from string class. My requirement is like that
making functions which acts on string class with make the design
brittle.please suggest me.

You've got it backwards. Inheriting from string is more brittle.
Using the defined
public interface to string is much more robust.
 

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,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top