Sponsored Content
Full Discussion: is it valid output ?
Top Forums Programming is it valid output ? Post 302311181 by otheus on Tuesday 28th of April 2009 06:08:03 AM
Old 04-28-2009
Please use ENGLISH... "o/p" is probably output; "pls" is PLEASE. This is a bulletin board, not a chat window.

The answer: Yes there is a memory leak. Why? Because the variable obj is a POINTER to an object of class A. The only methods accessible to class A are the constructor and destructor for class A. So, delete can call only these methods.

You can "fix" this simply by casting obj into a pointer to class B:
Code:
delete (b*)obj;

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is this a valid statement?

I need an if statement that recognizes whether files fitting a certain pattern exist in the current directory. Is this syntax valid: if ; then ... fi assuming that zero="0" and star="*". Is there a better way to write it? (3 Replies)
Discussion started by: mharley
3 Replies

2. Programming

valid code?

hey , everyone. I have a few questions about pieces of code and was wondering if someone could tell me what exactly they did or if they are even valid. bool1 && bool2 || bool3 <---in what order do these get processed? if (! isdigit(c)) <---What does this do? i = j % 3; <---what does this do?... (4 Replies)
Discussion started by: bebop1111116
4 Replies

3. Shell Programming and Scripting

': not a valid identifier

I am trying to write a bash script. I am able to do simple things like pass arguments, assign variables and echo the results. However, when I try to declare and array or anything a little more complicated I get ': not a valid identifier Here is my code so far: #!/bin/bash echo start t... (7 Replies)
Discussion started by: script123
7 Replies

4. Shell Programming and Scripting

Problems with valid input

Hello all I am having problems with a part of my script. Basically it asks for the user to enter a new id number for them. The catches are:- * It cannot already be existing (it will check a file) * It has to be four characters * It can only be numbers * It cannot call back into the... (2 Replies)
Discussion started by: ChrisHoogie
2 Replies

5. Shell Programming and Scripting

Specified substitution not valid for

Experts, In a script i get the following error: The specified substitution is not valid for this command Do you have any idea what is wrong with it? TITLE="Code Checker" # Script Titel # EXT="_UA99" # Eind van dirnaam # FILE="job.dat" # Zoekbestandsnaam # SEARCH="returncode 0" #... (1 Reply)
Discussion started by: klaasjan
1 Replies

6. Homework & Coursework Questions

Valid Name

Could someone help me by midnight tonight!!! Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Insert a reference to the Bourne shell as the command... (0 Replies)
Discussion started by: cody007
0 Replies

7. UNIX for Dummies Questions & Answers

Testing for valid DC's?

Ok so this is sort of a unix question. I am frequently logging into customers boxes and our product integrates with Active directory. I deal with a great deal of people who have no business being admins but are and they don't know squat about their network or their DC's. So a recurring problem... (4 Replies)
Discussion started by: MrEddy
4 Replies

8. Shell Programming and Scripting

how to check for valid password

I need to check if an account has a valid password. Would something like this work? read ACCNAME if grep -q "^$ACCNAME:\$6:" /etc/shadow; thenI noticed every entry in my shadow file that has a password starts with $6 ... it works for my current setup, but would it always work? I can't test... (4 Replies)
Discussion started by: ADay2Long
4 Replies

9. Shell Programming and Scripting

Fetch Valid String

Hi All, How to fetch the particular row based on my search command. For example Source Column Column A Column B 001,56123456 002,57123456 003,123456 Expected Output: 003,123456 To get this output I tried below mentioned function grep '123456' filename.txt (4 Replies)
Discussion started by: suresh_target
4 Replies
MAGE::Base(3pm) 					User Contributed Perl Documentation					   MAGE::Base(3pm)

NAME
Bio::MAGE::Base - generic base class SYNOPSIS
use Bio::MAGE::Base; # create an empty instance my $obj = Bio::MAGE::Base->new(); # create an instance and populate with data my $obj = Bio::MAGE::Base->new(attr1=>$val1, attr2=>$val2); # copy an existing instance my $obj_copy = $obj->new(); DESCRIPTION
The base class for all other Bio::MAGE classes CLASS METHODS
The following methods can all be called without first having an instance of the class via the Namespace::Class->methodname() syntax, i.e. the class name must be given as an argument to the method. $obj = class->new(%params) The "new()" method is the class constructor. Parameters: if given a list of name/value parameters the corresponding slots, attributes, or associations will have their initial values set by the constructor. Return value: It returns a reference to an object of the class. Side effects: It invokes the "initialize()" method if it is defined by the class. The following methods can all be called with either the Namespace::Class->methodname() and $obj->methodname() syntaxes. @names = get_slot_names() The "get_slot_names()" method is used to retrieve the name of all slots defined for a given object. NOTE: the list of names does not include attribute or association names. Return value: A list of the names of all slots defined for this class. Side effects: none @name_list = get_attribute_names() returns the list of attribute data members for this class. @name_list = get_association_names() returns the list of association data members for this class. @class_list = get_superclasses() returns the list of superclasses for this class. @class_list = get_subclasses() returns the list of subclasses for this class. $name = class_name() Returns the full class name for this class. $package_name = package_name() Returns the base package name (i.e. no 'namespace::') of the package that contains this class. %assns = associations() returns the association meta-information in a hash where the keys are the association names and the values are "Association" objects that provide the meta-information for the association. INSTANCE METHODS
These methods must be invoked with the direct object syntax using an existing instance, i.e. $object->method_name(). $obj_copy = $obj->new() When invoked with an existing object reference and not a class name, the "new()" method acts as a copy constructor - with the new object's initial values set to be those of the existing object. Parameters: No input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied. Return value: It returns a reference to an object of the class. Side effects: It invokes the "initialize()" method if it is defined by the class. $obj->set_slots(%parameters) $obj->set_slots(@name_list, @value_list) The "set_slots()" method is used to set a number of slots at the same time. It has two different invocation methods. The first takes a named parameter list, and the second takes two array references. Return value: none Side effects: will call "croak()" if a slot_name is used that the class does not define. $obj->get_slots(@name_list) The "get_slots()" method is used to get the values of a number of slots at the same time. Return value: a list of instance objects Side effects: none $val = $obj->set_slot($name,$val) The "set_slot()" method sets the slot $name to the value $val Return value: the new value of the slot, i.e. $val Side effects: none $val = $obj->get_slot($name) The "get_slot()" method is used to get the values of a number of slots at the same time. Return value: a single slot value, or undef if the slot has not been initialized. Side effects: none throw Title : throw Usage : Function: Example : Returns : Args : throw_not_implemented Title : throw_not_implemented Usage : Function: Example : Returns : Args : BUGS
Please send bug reports to the project mailing list: () AUTHOR
SEE ALSO
perl(1). perl v5.10.1 2006-08-23 MAGE::Base(3pm)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy