Overridden functions and virtual functions are two different concepts...
1) Two functions in the same scope having same but different signatures =
Over Loading
2) Two functions having same signatures but one defined in parent class and
the other defined in child class == Overriding
3) Virtual functions, allow for run time polymorphism among overridden
functions.(only when invoked using pointer)

btw I'm still trying to think if preventing function over-riding is
possible...


Regards,
Sandeep Jain



On Sun, Jul 31, 2011 at 10:13 PM, Ankit Minglani
<ankit.mingl...@gmail.com>wrote:

> @aditi : in C++ you define a function virtual to let the derived class give
> its own definition for the same. and in that case the functions are
> overridden. unlike in JAVA where no virtual keyword is needed .. so if you
> write the same code as above in java .. that may be referred to as Method
> overriding .. but not in cpp.
>
>
> On Sun, Jul 31, 2011 at 9:34 AM, aditi garg <aditi.garg.6...@gmail.com>wrote:
>
>> @ Ankit: Wat is overriding actually thn?
>>
>>
>> On Sun, Jul 31, 2011 at 9:58 PM, Anika Jain <anika.jai...@gmail.com>wrote:
>>
>>> ohkk.. m so sorry
>>>
>>>
>>> On Sun, Jul 31, 2011 at 9:41 PM, Ankit Minglani <
>>> ankit.mingl...@gmail.com> wrote:
>>>
>>>> @anika: This is not function overriding i think .. you cannot call the
>>>> f() function of the base class from the derived class object .. what you 
>>>> are
>>>> doing is creating a object of the derived class and calling the version of
>>>> f() that belong to derived class B .. ie is the same class object is 
>>>> calling
>>>> the same class function .
>>>>
>>>> correct me if i m wrong .
>>>>
>>>>
>>>> On Sun, Jul 31, 2011 at 8:42 AM, Anika Jain <anika.jai...@gmail.com>wrote:
>>>>
>>>>> @ muthu : not declaring tht function as virtual wont save overriding
>>>>>
>>>>> class A
>>>>> {
>>>>>     int a;
>>>>>
>>>>>     public:
>>>>>     void f()
>>>>>     {}
>>>>>     int f2(){}
>>>>> };
>>>>>
>>>>> class B:public A
>>>>> {
>>>>>     public:
>>>>>     void f()
>>>>>     {
>>>>>     cout<<"abc\n";
>>>>>     }
>>>>> };
>>>>>
>>>>> int main()
>>>>> {
>>>>>     B ob;
>>>>>     ob.f();
>>>>>     return 0;
>>>>> }
>>>>>
>>>>> in this output is abc..
>>>>> so overriding occured
>>>>>
>>>>>
>>>>> On Sun, Jul 31, 2011 at 8:41 PM, muthu raj <muthura...@gmail.com>wrote:
>>>>>
>>>>>> Using friend functions we can only invoke already defined private
>>>>>> functions. We cannot override or prevent overriding using friend 
>>>>>> functions.
>>>>>> The problem here is how to prevent base class function from being 
>>>>>> overridden
>>>>>> in derived class.
>>>>>>
>>>>>> *Muthuraj R
>>>>>> IV th Year , ISE
>>>>>> PESIT , Bangalore*
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Jul 31, 2011 at 8:04 AM, Anika Jain 
>>>>>> <anika.jai...@gmail.com>wrote:
>>>>>>
>>>>>>> what if we write that function as private of base class.. and make a
>>>>>>> function in derived class that is friend function of the base class do 
>>>>>>> that
>>>>>>> it can call tht private function of base.??
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Jul 31, 2011 at 8:25 PM, muthu raj <muthura...@gmail.com>wrote:
>>>>>>>
>>>>>>>> Yeah but there is no equivalent of final keyword in c++.....So to
>>>>>>>> prevent member function from overriding in derived class in c++ dont 
>>>>>>>> declare
>>>>>>>> the member function as virtual. Then it cannot be overridden in derived
>>>>>>>> class. There is no other way of preventing a member function of base 
>>>>>>>> class
>>>>>>>> from being overridden.
>>>>>>>>
>>>>>>>> *Muthuraj R
>>>>>>>> IV th Year , ISE
>>>>>>>> PESIT , Bangalore*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal <
>>>>>>>> himanshukansal...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> i think there is no keyword known as final in c++.....maybe u are
>>>>>>>>> talking with respect to java....
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Jul 31, 2011 at 8:03 PM, muthu raj 
>>>>>>>>> <muthura...@gmail.com>wrote:
>>>>>>>>>
>>>>>>>>>> By  declaring the function a static final f().....
>>>>>>>>>> *Muthuraj R
>>>>>>>>>> IV th Year , ISE
>>>>>>>>>> PESIT , Bangalore*
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal <
>>>>>>>>>> himanshukansal...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> sry i think....i misspelled d ques....
>>>>>>>>>>> d ques was....
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> how will you protect a derived class to override base class's
>>>>>>>>>>> member function in c++....
>>>>>>>>>>>
>>>>>>>>>>> say if there is a function f() in base class then derived should
>>>>>>>>>>> not be able to
>>>>>>>>>>> override f() to provide its own definition.....
>>>>>>>>>>> but The function must be accessible in derived class.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> PS:dont try to make the function private in base class( it will
>>>>>>>>>>> be
>>>>>>>>>>> become inaccessible in derived class).
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Jul 31, 2011 at 7:49 PM, himanshu kansal <
>>>>>>>>>>> himanshukansal...@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> how will you protect a base class to override its member
>>>>>>>>>>>> function in
>>>>>>>>>>>> derived class....
>>>>>>>>>>>>
>>>>>>>>>>>> say if there is a function f() in base class then derived cannot
>>>>>>>>>>>> override f() to provide its own definition.....
>>>>>>>>>>>> The function must be accessible in derived class.
>>>>>>>>>>>>
>>>>>>>>>>>> PS:dont try to make the function private in base class( it will
>>>>>>>>>>>> be
>>>>>>>>>>>> become inaccessible in derived class).
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>>       Regards
>>>>>>>>>>> Himanshu Kansal
>>>>>>>>>>>   Msc Comp. sc.
>>>>>>>>>>> (University of Delhi)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  --
>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>> Google Groups "Algorithm Geeks" group.
>>>>>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  --
>>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>>> Groups "Algorithm Geeks" group.
>>>>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>>>>> For more options, visit this group at
>>>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>       Regards
>>>>>>>>> Himanshu Kansal
>>>>>>>>>   Msc Comp. sc.
>>>>>>>>> (University of Delhi)
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Algorithm Geeks" group.
>>>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>>>> For more options, visit this group at
>>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Algorithm Geeks" group.
>>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Algorithm Geeks" group.
>>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Algorithm Geeks" group.
>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> The more you sweat in the field, the less you bleed in war."
>>>>
>>>> Ankit Minglani
>>>> NITK Surathkal
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New Delhi
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> The more you sweat in the field, the less you bleed in war."
>
> Ankit Minglani
> NITK Surathkal
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to