What are Interfaces?
Manipulating a class needs public interface in the C++. It shows that what will be the way of using this class by other users. It is clear that if you get added in the public interface, it will become difficult to get rid of this connection.
It is not good that you will start adding on the interface with small functions. Write the name according to its function. Always declare the name of the function. Otherwise, it will make confusion for you and others. Be careful while choosing the type of the function. If you have chosen a virtual function from a used class then no one can use your function.
It is good if the interface is stable. Write down the interface earlier to applying it. If you have written the interface in stat then you will be confused about the working of this class with others.
Inheritance and Class Design
Next thing is to know the availability of things before making a sub class. You can add protected techniques as it will be viewed by the sub classes.
How can a function become a virtual? It acts as virtual if the execution is different in each subclass. When a function will stop changing process, it will be called non virtual.
If you like to create a class which will permit the users to check the traffic and your subclasses will make changed ways of noticing the traffic, then you have to practice this:
// The Packet is used to get idea related to packets of network
void addPacket (const Packet& network_packet);
int getAveragePacketSize ();
int getMaxPacket ();
virtual bool isOverloaded ();
There are some processes which will not get changed on any step. People have different views about overindulgence on net. It is different according to the situation. In some case, 10 Megabits/sec can cause overload, and for some others, it needs 100 Megabits/sec.
Always keep in mind that the model which is used for inheritance is –a. here, is-a shows that the sub class can come on any place where the main class can come into view. For a user, it does not make any difference if the class is a parent or a sub class
When you start creating “is-a” association, so keeps in mind not to use the sub classes which are not needed. If we are going to formulate a function for birds then we can make an additional class for those birds who are not able to fly. So, we have to make two sub classes for birds. In one class these birds will be shown that can soar and other will have birds like emus and penguins. But it will make your function messy. You can view that it does not make any difference if we do not make 2 classes. So, think carefully and make changes in your program before implementing it.