|
I am new to VC8 and simply cannot find how to change fonts and colors of the source code editor. Any hints?
Thanks
uli
|
|
|
|
|
tools->options->Environment->Font and colors
|
|
|
|
|
what is the use of STL ??
~Raju~~
|
|
|
|
|
rajugis wrote: what is the use of STL ??
It depends on your background.
(as a start, you may have a look here)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
A generic answer would be: STL is used to write C++ programs.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Think in terms of what is the use of a library.
It will contain several already implemented routines.
Like a Math library would have functions to do matrix multiplication and addition.
Similarly STL is a templatized library used for generic programming and contains several containers and algorithms.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
We know the different kind of data structures called stack, queue list etc. So for this kind of things when you want to create list you have to write entire code for this. And also you must and should specifies the type list, where as coming to the STL you need not bother about the things. There we have ready made data structures available to perform our operations. So we need not write the operations again and again directly we can use this data structure by using standard name space. One more advantage when we use this is we need not to write logic for sorting, traversing etc. there we existed some ready made functions which can accomplish our work very easy manner.
sampath-padamatinti
|
|
|
|
|
Hey Buddy Every language has set of functions which will come with ur complier as STL u can Perform operation easily so that the developing time for the code is reduced and where progrmmers can concerntrate on other issues and get the things done faster in application development.
For example lets take an array contains group of elements if we want to sort that array we have to write code manully and execute it instead if we go through some set of STL functions we can sort them if we just use the functions...
To say u simply a predefined set of Functions which works on the set of Data Structures to get the things done in faster and efficient way...
Regards,
Pravin.
|
|
|
|
|
in mysql database, I created 2 fields INT(64) and INT(96).
This is first time I use integer field over 32 value, I need your comments and experiences to read/write the fields.
How do you treat them in your program?
BTW:
reading from db returns a buffer (char*) and buffer length, which looks like "328273645272829292291993933838".
|
|
|
|
|
you must convert the string to a number the right way. Cant you get the number right of the DB. Maybe in the is number. -> Type cast.
Or ind an API-function or write one. It depends on what the DB returns. Read the docs of the DB.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
For 64-bit integers you can use _atoi64[^], which returns __int64.
There is no 96-bit integer in standard C++ so you will have to use a library for example bigint[^].
Saurabh
modified on Friday, September 18, 2009 5:38 AM
|
|
|
|
|
Hi,
Could anyone please tell me the exact use of pure virtual function in C++. (ie the abstract class)
I understand the concept. But I want to know in which situation we really need those? Or basically what is the practical use of it?
thanks
-----------------------------
I am a beginner
modified on Friday, September 18, 2009 2:42 AM
|
|
|
|
|
hrishiS wrote: Could anyone please tell me the exact use of pure virtual function in C++.
Roughly speaking is what you need in order to design interfaces.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks for your reply pallini,
But there is always a small difference between the abstract class and interface. Anyway, when we talk about interface also, when do we need/use them exactly?Could you please give me a practical example.
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: But there is always a small difference between the abstract class and interface
No, there isn't - not if the abstract class has a) no data, and b) declares all of it's methods to be public and abstract.
hrishiS wrote: Anyway, when we talk about interface also, when do we need/use them exactly
When you want to define some API you want a class to conform to, but don't want to constrain the implementation beyond that. For example - look at COM - that's ALL interfaces. For a more practical example, let's look at iterating through some collection of objects:
template<class T>
class IIterable
{
virtual void First() = 0;
virtual bool Next() = 0;
virtual const T& Current() const = 0;
};
This tells you what methods have to be implemented, and should also define the semantics of the methods, but does not constrain the implementation...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks a lot.
Even though I have no knowledge on COM,.I got the idea of it.
Please correct me if my idea is wrong...following is the abstract of what i understood...
- we need interface, in order to make an generic structure of so many class. Later when some one adds one more class, it forces the implementer of the class to follow some generic rules (must have those virtual methods)....
am I Correct?
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: - we need interface, in order to make an generic structure of so many class. Later when some one adds one more class, it forces the implementer of the class to follow some generic rules (must have those virtual methods)....
Not quite. The interface is used to enforce a contract between code that uses the interface and classes that derive from (and thus have to implement the interface). Using the example I gave before, we could define a Find function like this:
template<class T>
bool Find(IIterable<T> const& i, T const& lookFor)
{
i.First();
do
{
if (i.Current() == lookFor) return true;
} while (i.Next());
return false;
}
The IIterable interface enforces the 'Iterable' contract between Find and any class that implements Iterable.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
One more thing is that,
You have given the example for interface. But when do we need abstract class, ie which has some methods which are implemented in the base class .
-----------------------------
I am a beginner
|
|
|
|
|
When you want to offer a nearly complete implementation, but allowing some customisation by children of the class.
For example:
class DirectoryTreeWalker
{
DirectoryTreeWalker(std::string& path) { … }
void WalkIt() {
private:
virtual void FoundAFile(const std::string& file) = 0;
virtual void FoundADirectory(const std::string& file) = 0;
};
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
oh i got it...thanks a lot Sir for all your words
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: But there is always a small difference between the abstract class and interface.
An interface is a concept that is taken from other programing languages that natively supports interfaces: an interface simply describes the public method of an object, but doesn't have any functionality. This object should then be implemented by a class which inherits from the interface.
So, it means that the interface only contains pure virtual functions (and no data member).
An abstract class on the other hand is a class that cannot be instanciated directly, so you need to inherit from it. To make a class abstract, it needs to contain at least one pure virtual function (but it can contain other functions and also data members).
hrishiS wrote: Anyway, when we talk about interface also, when do we need/use them exactly?Could you please give me a practical example.
If you really want to implement the concept of an interface, then you need to use pure virtual functions for every function of the interface, because the interface cannot contain any funcitonality. All the functions from the interface are pure virtual functions.
|
|
|
|
|
Hey ,
Its just that when you want extendibilty of a class then u go to write pure virtual functions fr it.. This class can now be base class of all child clss who will just inherit it to implement the functions defined in there own way ... so its there to make a generic approach
|
|
|
|
|
You are talking about a standard virtual function, not a pure virtual function, which is not exaclty the same...
|
|
|
|
|
thanks Tiwari for your reply,
I need little more clarification, if you dont mind.
See, we can achieve the extensibility through a normal inheritance also right . The main reason of inheritance is reusable and extensibility of my base class. Thats what my understanding is. So in this case why we need some function to be declared (make = 0) in base class and again define it in derived class etc etc....we can directly declare and define in the derived class right..
May be one practical example would be appreciated. Or may be a scenario where we cannot go without it.
Thanks
-----------------------------
I am a beginner
|
|
|
|
|
It is used to define an interface that does not have any implementation.
Look at some design patterns - Design Patterns in C#[^].
They all use interfaces.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|